aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2020-05-11 18:42:13 -0300
committerSilvio Rhatto <rhatto@riseup.net>2020-05-11 18:42:13 -0300
commit3571ea4a5f71afbcdcd915f2a84a6622e3cb56be (patch)
treef84eae2ef4b638dcd15208bfd0ca354f54c89e52
parent521838ecfee5095770214a2246c0c95307215bd1 (diff)
downloadkvmx-3571ea4a5f71afbcdcd915f2a84a6622e3cb56be.tar.gz
kvmx-3571ea4a5f71afbcdcd915f2a84a6622e3cb56be.tar.bz2
Fix: support for newer kvm and screen such as those from debian buster
-rwxr-xr-xkvmx22
1 files changed, 19 insertions, 3 deletions
diff --git a/kvmx b/kvmx
index 730e0df..c0895a7 100755
--- a/kvmx
+++ b/kvmx
@@ -511,12 +511,27 @@ function kvmx_up {
#usb_opts="$usb_opts -chardev spicevmc,name=usbredir,id=usbredirchardev3"
#usb_opts="$usb_opts -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3"
+ # Check screen version
+ if screen --help | grep -q -- "-Logfile"; then
+ local screen_log="-L -Logfile $LOGFILE"
+ else
+ local screen_log="-L $LOGFILE"
+ fi
+
+ # Check kvm version
+ if kvm --help | grep -q -- "^-balloon"; then
+ local balloon="-balloon virtio"
+ else
+ local balloon="-device virtio-balloon"
+ fi
+
# Run virtual machine, nohup approach
# See https://en.wikipedia.org/wiki/Nohup#Overcoming_hanging
#nohup setsid kvm -m $memory -name $VM \
# -chardev "socket,id=monitor,path=$MONITORFILE,server,nowait" -mon chardev=monitor,mode=readline \
# -chardev "socket,id=serial0,path=$CONSOLEFILE,server,nowait" -device isa-serial,chardev=serial0 \
- # -smp $smp -cpu host -balloon virtio \
+ # -smp $smp -cpu host \
+ # $balloon \
# $graphics $shared \
# $image_opts \
# $spice_opts \
@@ -528,10 +543,11 @@ function kvmx_up {
# Run virtual machine, screen approach
# This is more immune to hangups
- screen -L $LOGFILE -S kvmx-qemu-$VM -d -m kvm -m $memory -name $VM \
+ screen $screen_log -S kvmx-qemu-$VM -d -m kvm -m $memory -name $VM \
-chardev "socket,id=monitor,path=$MONITORFILE,server,nowait" -mon chardev=monitor,mode=readline \
-chardev "socket,id=serial0,path=$CONSOLEFILE,server,nowait" -device isa-serial,chardev=serial0 \
- -smp $smp -cpu host -balloon virtio \
+ -smp $smp -cpu host \
+ $balloon \
$graphics $shared \
$image_opts \
$spice_opts \