add a display setting in the conf file

This commit is contained in:
Jinming Wu, Patrick 2021-11-09 00:03:58 +08:00 committed by Martin Wimpress
parent 0af524e3e5
commit 194b303a54

View file

@ -1033,6 +1033,16 @@ function usage() {
exit 1
}
function display_param_check() {
if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then
echo "ERROR! Requested output '${OUTPUT}' is not recognised."
exit 1
elif [ "${OUTPUT}" == "spice" ] && ! command -v spicy &>/dev/null; then
echo "ERROR! Requested SPICE display, but 'spicy' is not installed."
exit 1
fi
}
# Lowercase variables are used in the VM config file only
boot="efi"
bridge=""
@ -1056,7 +1066,7 @@ DELETE_DISK=0
DELETE_VM=0
FULLSCREEN=""
FULLSPICY=""
OUTPUT="sdl"
OUTPUT=""
PUBLIC=""
PUBLIC_PERMS=""
PUBLIC_TAG=""
@ -1121,13 +1131,7 @@ else
shift;;
-display|--display)
OUTPUT="${2}"
if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then
echo "ERROR! Requested output '${OUTPUT}' is not recognised."
exit 1
elif [ "${OUTPUT}" == "spice" ] && ! command -v spicy &>/dev/null; then
echo "ERROR! Requested SPICE display, but 'spicy' is not installed."
exit 1
fi
display_param_check
shift
shift;;
-fullscreen|--fullscreen|-full-screen|--full-screen)
@ -1199,6 +1203,15 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
disk_size="${disk}"
fi
if [ -z "${OUTPUT}" ]; then
if [ -z "${display}" ]; then
OUTPUT="sdl"
else
OUTPUT="${display}"
display_param_check
fi
fi
if [ "${tpm}" == "on" ]; then
SWTPM=$(command -v swtpm)
if [ ! -e "${SWTPM}" ]; then