From caa7bc311d035f2b413372c4c5eae53489530f5a Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 8 Apr 2025 07:59:16 +0200 Subject: [PATCH] feat: Detect Docker Desktop (#242) --- Dockerfile | 1 + src/proc.sh | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index b032b2f..e55b45c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ RUN set -eu && \ wget \ 7zip \ curl \ + fdisk \ nginx \ procps \ seabios \ diff --git a/src/proc.sh b/src/proc.sh index e158d9d..de03b89 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -34,10 +34,10 @@ if [[ "$KVM" != [Nn]* ]]; then KVM_ERR="" if [ ! -e /dev/kvm ]; then - KVM_ERR="(device file missing)" + KVM_ERR="(/dev/kvm is missing)" else if ! sh -c 'echo -n > /dev/kvm' &> /dev/null; then - KVM_ERR="(no write access)" + KVM_ERR="(/dev/kvm is unwriteable)" fi fi @@ -45,9 +45,17 @@ if [[ "$KVM" != [Nn]* ]]; then KVM="N" if [[ "$OSTYPE" =~ ^darwin ]]; then warn "you are using macOS which has no KVM support, this will cause a major loss of performance." - else - error "KVM acceleration not available $KVM_ERR, this will cause a major loss of performance." - error "See the FAQ on how to diagnose the cause, or continue without KVM by setting KVM=N (not recommended)." + else + kernel=$(uname -a) + case "${kernel,,}" in + *"microsoft"* ) + error "Please bind '/dev/kvm' as a volume in the optional container settings when using Docker Desktop." ;; + *"synology"* ) + error "Please make sure that Synology VMM (Virtual Machine Manager) is installed and that '/dev/kvm' is binded to this container." ;; + *) + error "KVM acceleration is not available $KVM_ERR, this will cause a major loss of performance." + error "See the FAQ for possible causes, or continue without it by adding KVM: \"N\" (not recommended)." ;; + esac [[ "$DEBUG" != [Yy1]* ]] && exit 88 fi fi