From 57c58120857a49b0c2dbf628147ea8861c2837c6 Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 15 Nov 2024 04:14:39 +0100 Subject: [PATCH] feat: Support UUID flag (#162) --- src/config.sh | 2 ++ src/proc.sh | 12 ++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/config.sh b/src/config.sh index f53e2a4..670d51c 100644 --- a/src/config.sh +++ b/src/config.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail +: "${UUID:=""}" : "${SERIAL:="mon:stdio"}" : "${USB:="qemu-xhci,id=xhci"}" : "${MONITOR:="telnet:localhost:7100,server,nowait,nodelay"}" @@ -13,6 +14,7 @@ RAM_OPTS=$(echo "-m ${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g') MON_OPTS="-monitor $MONITOR -name $PROCESS,process=$PROCESS,debug-threads=on" [ -n "$USB" ] && [[ "${USB,,}" != "no"* ]] && USB_OPTS="-device $USB -device usb-kbd -device usb-tablet" MAC_OPTS="-machine type=${MACHINE},secure=${SECURE},dump-guest-core=off${KVM_OPTS}" +[ -n "$UUID" ] && MAC_OPTS="$MAC_OPTS -uuid $UUID" DEV_OPTS="-object rng-random,id=objrng0,filename=/dev/urandom" DEV_OPTS+=" -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c" [[ "${BOOT_MODE,,}" != "windows"* ]] && DEV_OPTS+=" -device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4" diff --git a/src/proc.sh b/src/proc.sh index 1494e25..784a822 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -44,15 +44,11 @@ if [[ "$KVM" != [Nn]* ]]; then if [ -n "$KVM_ERR" ]; 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." + warn "you are using macOS which has no KVM support, this will cause a major loss of performance." else - if grep -qi Microsoft /proc/version; then - warn "you are using Windows 10 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)." - [[ "$DEBUG" != [Yy1]* ]] && exit 88 - fi + 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)." + [[ "$DEBUG" != [Yy1]* ]] && exit 88 fi fi