Loading Dockerfile +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ RUN set -eu && \ wget \ 7zip \ curl \ fdisk \ nginx \ swtpm \ procps \ Loading src/disk.sh +30 −9 Original line number Diff line number Diff line Loading @@ -362,6 +362,8 @@ createDevice () { local DISK_FMT=$5 local DISK_IO=$6 local DISK_CACHE=$7 local DISK_SERIAL=$8 local DISK_SECTORS=$9 local DISK_ID="data$DISK_INDEX" local index="" Loading @@ -375,29 +377,29 @@ createDevice () { ;; "usb" ) result+=",if=none \ -device usb-storage,drive=${DISK_ID}${index}" -device usb-storage,drive=${DISK_ID}${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "nvme" ) result+=",if=none \ -device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}" -device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "ide" | "sata" ) result+=",if=none \ -device ich9-ahci,id=ahci${DISK_INDEX},addr=$DISK_ADDRESS \ -device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}" -device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "blk" | "virtio-blk" ) result+=",if=none \ -device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}" -device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "scsi" | "virtio-scsi" ) result+=",if=none \ -device virtio-scsi-pci,id=${DISK_ID}b,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2 \ -device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}" -device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; esac Loading Loading @@ -525,7 +527,7 @@ addDisk () { fi DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE") DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE" "" "") return 0 } Loading @@ -540,7 +542,26 @@ addDevice () { [ -z "$DISK_DEV" ] && return 0 [ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55 DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE") local sectors="" local result logical physical result=$(fdisk -l "$DISK_DEV" | grep -m 1 -o "(logical/physical): .*" | cut -c 21-) logical="${result%% *}" physical=$(echo "$result" | grep -m 1 -o "/ .*" | cut -c 3-) physical="${physical%% *}" if [ -n "$physical" ]; then if [[ "$physical" == "512" ]] || [[ "$physical" == "4096" ]]; then if [[ "$physical" == "4096" ]]; then sectors=",logical_block_size=$logical,physical_block_size=$physical" fi else warn "Unknown physical sector size: $physical for $DISK_DEV" fi else warn "Failed to determine the sector size for $DISK_DEV" fi DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE" "" "$sectors") return 0 } Loading Loading @@ -586,9 +607,9 @@ if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then *".iso" ) DISK_OPTS+=$(addMedia "$BOOT" "$MEDIA_TYPE" "$BOOT_INDEX" "0x5") ;; *".img" | *".raw" ) DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "raw" "$DISK_IO" "$DISK_CACHE") ;; DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "raw" "$DISK_IO" "$DISK_CACHE" "" "") ;; *".qcow2" ) DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "qcow2" "$DISK_IO" "$DISK_CACHE") ;; DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "qcow2" "$DISK_IO" "$DISK_CACHE" "" "") ;; * ) error "Invalid BOOT image specified, extension \".${BOOT/*./}\" is not recognized!" && exit 80 ;; esac Loading src/network.sh +5 −5 Original line number Diff line number Diff line Loading @@ -342,17 +342,17 @@ closeNetwork() { checkOS() { local name local kernel local os="" local if="macvlan" name=$(uname -a) kernel=$(uname -a) [[ "${name,,}" == *"darwin"* ]] && os="Docker Desktop for macOS" [[ "${name,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows" [[ "${kernel,,}" == *"darwin"* ]] && os="Docker Desktop for macOS" [[ "${kernel,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows" if [[ "$DHCP" == [Yy1]* ]]; then if="macvtap" [[ "${name,,}" == *"synology"* ]] && os="Synology Container Manager" [[ "${kernel,,}" == *"synology"* ]] && os="Synology Container Manager" fi if [ -n "$os" ]; then Loading src/proc.sh +14 −6 Original line number Diff line number Diff line Loading @@ -20,14 +20,14 @@ 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)" else flags=$(sed -ne '/^flags/s/^.*: //p' /proc/cpuinfo) if ! grep -qw "vmx\|svm" <<< "$flags"; then KVM_ERR="(vmx/svm disabled)" KVM_ERR="(not enabled in BIOS)" fi fi fi Loading @@ -37,8 +37,16 @@ if [[ "$KVM" != [Nn]* ]]; then 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)." 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 Loading Loading
Dockerfile +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ RUN set -eu && \ wget \ 7zip \ curl \ fdisk \ nginx \ swtpm \ procps \ Loading
src/disk.sh +30 −9 Original line number Diff line number Diff line Loading @@ -362,6 +362,8 @@ createDevice () { local DISK_FMT=$5 local DISK_IO=$6 local DISK_CACHE=$7 local DISK_SERIAL=$8 local DISK_SECTORS=$9 local DISK_ID="data$DISK_INDEX" local index="" Loading @@ -375,29 +377,29 @@ createDevice () { ;; "usb" ) result+=",if=none \ -device usb-storage,drive=${DISK_ID}${index}" -device usb-storage,drive=${DISK_ID}${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "nvme" ) result+=",if=none \ -device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}" -device nvme,drive=${DISK_ID}${index},serial=deadbeaf${DISK_INDEX}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "ide" | "sata" ) result+=",if=none \ -device ich9-ahci,id=ahci${DISK_INDEX},addr=$DISK_ADDRESS \ -device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}" -device ide-hd,drive=${DISK_ID},bus=ahci$DISK_INDEX.0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "blk" | "virtio-blk" ) result+=",if=none \ -device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}" -device virtio-blk-pci,drive=${DISK_ID},bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; "scsi" | "virtio-scsi" ) result+=",if=none \ -device virtio-scsi-pci,id=${DISK_ID}b,bus=pcie.0,addr=$DISK_ADDRESS,iothread=io2 \ -device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}" -device scsi-hd,drive=${DISK_ID},bus=${DISK_ID}b.0,channel=0,scsi-id=0,lun=0,rotation_rate=$DISK_ROTATION${index}${DISK_SERIAL}${DISK_SECTORS}" echo "$result" ;; esac Loading Loading @@ -525,7 +527,7 @@ addDisk () { fi DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE") DISK_OPTS+=$(createDevice "$DISK_FILE" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "$DISK_FMT" "$DISK_IO" "$DISK_CACHE" "" "") return 0 } Loading @@ -540,7 +542,26 @@ addDevice () { [ -z "$DISK_DEV" ] && return 0 [ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55 DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE") local sectors="" local result logical physical result=$(fdisk -l "$DISK_DEV" | grep -m 1 -o "(logical/physical): .*" | cut -c 21-) logical="${result%% *}" physical=$(echo "$result" | grep -m 1 -o "/ .*" | cut -c 3-) physical="${physical%% *}" if [ -n "$physical" ]; then if [[ "$physical" == "512" ]] || [[ "$physical" == "4096" ]]; then if [[ "$physical" == "4096" ]]; then sectors=",logical_block_size=$logical,physical_block_size=$physical" fi else warn "Unknown physical sector size: $physical for $DISK_DEV" fi else warn "Failed to determine the sector size for $DISK_DEV" fi DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE" "" "$sectors") return 0 } Loading Loading @@ -586,9 +607,9 @@ if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then *".iso" ) DISK_OPTS+=$(addMedia "$BOOT" "$MEDIA_TYPE" "$BOOT_INDEX" "0x5") ;; *".img" | *".raw" ) DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "raw" "$DISK_IO" "$DISK_CACHE") ;; DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "raw" "$DISK_IO" "$DISK_CACHE" "" "") ;; *".qcow2" ) DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "qcow2" "$DISK_IO" "$DISK_CACHE") ;; DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "qcow2" "$DISK_IO" "$DISK_CACHE" "" "") ;; * ) error "Invalid BOOT image specified, extension \".${BOOT/*./}\" is not recognized!" && exit 80 ;; esac Loading
src/network.sh +5 −5 Original line number Diff line number Diff line Loading @@ -342,17 +342,17 @@ closeNetwork() { checkOS() { local name local kernel local os="" local if="macvlan" name=$(uname -a) kernel=$(uname -a) [[ "${name,,}" == *"darwin"* ]] && os="Docker Desktop for macOS" [[ "${name,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows" [[ "${kernel,,}" == *"darwin"* ]] && os="Docker Desktop for macOS" [[ "${kernel,,}" == *"microsoft"* ]] && os="Docker Desktop for Windows" if [[ "$DHCP" == [Yy1]* ]]; then if="macvtap" [[ "${name,,}" == *"synology"* ]] && os="Synology Container Manager" [[ "${kernel,,}" == *"synology"* ]] && os="Synology Container Manager" fi if [ -n "$os" ]; then Loading
src/proc.sh +14 −6 Original line number Diff line number Diff line Loading @@ -20,14 +20,14 @@ 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)" else flags=$(sed -ne '/^flags/s/^.*: //p' /proc/cpuinfo) if ! grep -qw "vmx\|svm" <<< "$flags"; then KVM_ERR="(vmx/svm disabled)" KVM_ERR="(not enabled in BIOS)" fi fi fi Loading @@ -37,8 +37,16 @@ if [[ "$KVM" != [Nn]* ]]; then 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)." 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 Loading