mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
Add -display none option. Close #110
Using the -display none option will start the VM with SPICE enabled but no display attached. The .ports file in the VM directory can be used to lookup the SSH and SPICE ports used by the VM.
This commit is contained in:
parent
0567229405
commit
205023fd50
2 changed files with 25 additions and 22 deletions
|
@ -475,7 +475,7 @@ Usage
|
||||||
|
|
||||||
You can also pass optional parameters
|
You can also pass optional parameters
|
||||||
--delete : Delete the disk image.
|
--delete : Delete the disk image.
|
||||||
--display : Select display backend. 'sdl' (default), 'gtk' or 'spice'
|
--display : Select display backend. 'sdl' (default), 'gtk', 'none' or 'spice'
|
||||||
--fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)
|
--fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)
|
||||||
--ignore-msrs-always : Configure KVM to always ignore unhandle machine-specific registers
|
--ignore-msrs-always : Configure KVM to always ignore unhandle machine-specific registers
|
||||||
--screen <screen> : Use specified screen to determine the window size.
|
--screen <screen> : Use specified screen to determine the window size.
|
||||||
|
|
45
quickemu
45
quickemu
|
@ -197,6 +197,7 @@ function vm_boot() {
|
||||||
local CPU=""
|
local CPU=""
|
||||||
local DISK_USED=""
|
local DISK_USED=""
|
||||||
local DISPLAY_DEVICE=""
|
local DISPLAY_DEVICE=""
|
||||||
|
local DISPLAY_RENDER=""
|
||||||
local EFI_CODE=""
|
local EFI_CODE=""
|
||||||
local EFI_VARS=""
|
local EFI_VARS=""
|
||||||
local GUEST_CPU_CORES=""
|
local GUEST_CPU_CORES=""
|
||||||
|
@ -630,7 +631,7 @@ function vm_boot() {
|
||||||
# https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/
|
# https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/
|
||||||
if [ "${guest_os}" == "linux" ]; then
|
if [ "${guest_os}" == "linux" ]; then
|
||||||
case ${OUTPUT} in
|
case ${OUTPUT} in
|
||||||
spice) DISPLAY_DEVICE="qxl-vga";;
|
none|spice) DISPLAY_DEVICE="qxl-vga";;
|
||||||
*) DISPLAY_DEVICE="virtio-vga";;
|
*) DISPLAY_DEVICE="virtio-vga";;
|
||||||
esac
|
esac
|
||||||
elif [ "${guest_os}" == "macos" ]; then
|
elif [ "${guest_os}" == "macos" ]; then
|
||||||
|
@ -651,10 +652,6 @@ function vm_boot() {
|
||||||
|
|
||||||
echo -n " - Display: ${OUTPUT^^}, ${DISPLAY_DEVICE}"
|
echo -n " - Display: ${OUTPUT^^}, ${DISPLAY_DEVICE}"
|
||||||
|
|
||||||
if [ "${OUTPUT}" == "spice" ]; then
|
|
||||||
OUTPUT="none"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build the video configuration
|
# Build the video configuration
|
||||||
VIDEO="-device ${DISPLAY_DEVICE}"
|
VIDEO="-device ${DISPLAY_DEVICE}"
|
||||||
|
|
||||||
|
@ -669,17 +666,20 @@ function vm_boot() {
|
||||||
fi
|
fi
|
||||||
VIDEO="${VIDEO} ${FULLSCREEN}"
|
VIDEO="${VIDEO} ${FULLSCREEN}"
|
||||||
|
|
||||||
if [ "${OUTPUT}" == "gtk" ]; then
|
# Map Quickemu OUTPUT to QEMU -display
|
||||||
OUTPUT="${OUTPUT},grab-on-hover=on,zoom-to-fit=off"
|
case ${OUTPUT} in
|
||||||
# GL is not working with GTK and virtio-vga
|
gtk)
|
||||||
if [ "${DISPLAY_DEVICE}" == "virtio-vga" ]; then
|
DISPLAY_RENDER="${OUTPUT},grab-on-hover=on,zoom-to-fit=off"
|
||||||
GL="off"
|
# GL is not working with GTK and virtio-vga
|
||||||
fi
|
if [ "${DISPLAY_DEVICE}" == "virtio-vga" ]; then
|
||||||
fi
|
GL="off"
|
||||||
|
fi
|
||||||
if [ "${OUTPUT}" != "none" ]; then
|
;;
|
||||||
OUTPUT="${OUTPUT},gl=${GL}"
|
none|spice)
|
||||||
fi
|
DISPLAY_RENDER="none";;
|
||||||
|
*)
|
||||||
|
DISPLAY_RENDER="${OUTPUT},gl=${GL}";;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "${GL}" == "on" ] && [[ "${DISPLAY_DEVICE}" == *"virtio"* ]]; then
|
if [ "${GL}" == "on" ] && [[ "${DISPLAY_DEVICE}" == *"virtio"* ]]; then
|
||||||
if [ "${QEMU_VER_SHORT}" -ge 61 ]; then
|
if [ "${QEMU_VER_SHORT}" -ge 61 ]; then
|
||||||
|
@ -725,7 +725,7 @@ function vm_boot() {
|
||||||
SPICE_PORT=$(get_port 5930 9)
|
SPICE_PORT=$(get_port 5930 9)
|
||||||
if [ -z "${SPICE_PORT}" ]; then
|
if [ -z "${SPICE_PORT}" ]; then
|
||||||
echo " - SPICE: All SPICE ports have been exhausted."
|
echo " - SPICE: All SPICE ports have been exhausted."
|
||||||
if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice-app" ]; then
|
if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then
|
||||||
echo " ERROR! Requested SPICE display, but no SPICE ports are free."
|
echo " ERROR! Requested SPICE display, but no SPICE ports are free."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -797,7 +797,7 @@ function vm_boot() {
|
||||||
${CPU} ${SMP}
|
${CPU} ${SMP}
|
||||||
-m ${RAM_VM} ${BALLOON}
|
-m ${RAM_VM} ${BALLOON}
|
||||||
-smbios type=2,manufacturer="Wimpys World",product="Quickemu",version="${VERSION}",serial="jvzclfjbeyq.pbz",location="wimpysworld.com",asset="${VMNAME}"
|
-smbios type=2,manufacturer="Wimpys World",product="Quickemu",version="${VERSION}",serial="jvzclfjbeyq.pbz",location="wimpysworld.com",asset="${VMNAME}"
|
||||||
${VIDEO} -display ${OUTPUT}
|
${VIDEO} -display ${DISPLAY_RENDER}
|
||||||
-device usb-ehci,id=input
|
-device usb-ehci,id=input
|
||||||
-device usb-kbd,bus=input.0
|
-device usb-kbd,bus=input.0
|
||||||
-device ${MOUSE},bus=input.0
|
-device ${MOUSE},bus=input.0
|
||||||
|
@ -918,12 +918,15 @@ function vm_boot() {
|
||||||
${QEMU} "${args[@]}" > "${VMDIR}/${VMNAME}.log" &
|
${QEMU} "${args[@]}" > "${VMDIR}/${VMNAME}.log" &
|
||||||
|
|
||||||
# If output is 'none' then SPICE was requested.
|
# If output is 'none' then SPICE was requested.
|
||||||
if [ ${OUTPUT} == "none" ]; then
|
if [ "${OUTPUT}" == "spice" ]; then
|
||||||
if [ -n "${PUBLIC}" ]; then
|
if [ -n "${PUBLIC}" ]; then
|
||||||
spicy --title "${VMNAME}" --port "${SPICE_PORT}" --spice-shared-dir "${PUBLIC}" "${FULLSPICY}" >/dev/null 2>&1 &
|
spicy --title "${VMNAME}" --port "${SPICE_PORT}" --spice-shared-dir "${PUBLIC}" "${FULLSPICY}" >/dev/null 2>&1 &
|
||||||
else
|
else
|
||||||
spicy --title "${VMNAME}" --port "${SPICE_PORT}" "${FULLSPICY}" >/dev/null 2>&1 &
|
spicy --title "${VMNAME}" --port "${SPICE_PORT}" "${FULLSPICY}" >/dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
elif [ "${OUTPUT}" == "none" ]; then
|
||||||
|
sleep 0.25
|
||||||
|
echo " - PID: ${VMNAME} ($(cat "${VMDIR}/${VMNAME}.pid"))"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +952,7 @@ function usage() {
|
||||||
echo
|
echo
|
||||||
echo "You can also pass optional parameters"
|
echo "You can also pass optional parameters"
|
||||||
echo " --delete : Delete the disk image."
|
echo " --delete : Delete the disk image."
|
||||||
echo " --display : Select display backend. 'sdl' (default), 'gtk' or 'spice'"
|
echo " --display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice'"
|
||||||
echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)"
|
echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)"
|
||||||
echo " --ignore-msrs-always : Configure KVM to always ignore unhandle machine-specific registers"
|
echo " --ignore-msrs-always : Configure KVM to always ignore unhandle machine-specific registers"
|
||||||
echo " --screen <screen> : Use specified screen to determine the window size."
|
echo " --screen <screen> : Use specified screen to determine the window size."
|
||||||
|
@ -1046,7 +1049,7 @@ else
|
||||||
shift;;
|
shift;;
|
||||||
-display|--display)
|
-display|--display)
|
||||||
OUTPUT="${2}"
|
OUTPUT="${2}"
|
||||||
if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then
|
if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then
|
||||||
echo "ERROR! Requested output '${OUTPUT}' is not recognised."
|
echo "ERROR! Requested output '${OUTPUT}' is not recognised."
|
||||||
exit 1
|
exit 1
|
||||||
elif [ "${OUTPUT}" == "spice" ] && ! command -v spicy &>/dev/null; then
|
elif [ "${OUTPUT}" == "spice" ] && ! command -v spicy &>/dev/null; then
|
||||||
|
|
Loading…
Reference in a new issue