From dd6a444cfc1ef527520a0e3490b6a243f0e7679c Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Wed, 24 Jun 2015 02:27:39 -0700 Subject: runqemu: disable graphic when no DISPLAY or vnc Disable graphic when no DISPLAY or vnc rather than print an error like: [snip] Could not initialize SDL(No available video device) - exiting [snip] Signed-off-by: Robert Yang --- scripts/runqemu | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/runqemu b/scripts/runqemu index 09c507dc7a..78dfd1a047 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -70,6 +70,8 @@ SCRIPT_KERNEL_OPT="" SERIALSTDIO="" KVM_ENABLED="no" KVM_ACTIVE="no" +GRAPHIC="yes" +PUBLICVNC="no" # Determine whether the file is a kernel or QEMU image, and set the # appropriate variables @@ -142,8 +144,7 @@ while true; do ISOFS=true ;; "nographic") - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic" - SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0" + GRAPHIC="no" ;; "serial") SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio" @@ -187,6 +188,7 @@ while true; do ;; "publicvnc") SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -vnc 0.0.0.0:0" + PUBLICVNC="yes" ;; "") break ;; *) @@ -291,6 +293,13 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then fi fi +# Disable graphic when no DISPLAY or -nographic is specified. +if [ "$GRAPHIC" = "no" ] || [ -z "$DISPLAY" -a "$PUBLICVNC" = "no" ] ; then + echo "Disabling graphic." + SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic" + SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0" +fi + machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'` # MACHINE is now set for all cases -- cgit 1.2.3-korg