refactor: update initialisation to use new param check functions
This commit is contained in:
parent
44e653a48d
commit
45191a796e
48
quickemu
48
quickemu
|
|
@ -1812,33 +1812,17 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
|
||||||
usage;;
|
usage;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
# Braille support requires SDL. Override $display if braille was requested.
|
echo "ERROR! Virtual machine configuration not found."
|
||||||
if [ -n "${BRAILLE}" ]; then
|
usage
|
||||||
display="sdl"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
display_param_check
|
display_param_check
|
||||||
|
ports_param_check
|
||||||
sound_card_param_check
|
sound_card_param_check
|
||||||
|
tpm_param_check
|
||||||
viewer_param_check
|
viewer_param_check
|
||||||
|
|
||||||
# Set the default 3D acceleration.
|
|
||||||
if [ -z "${gl}" ]; then
|
|
||||||
if command -v glxinfo &>/dev/null; then
|
|
||||||
GLSL_VER=$(glxinfo | grep "OpenGL ES GLSL" | awk '{print $NF}')
|
|
||||||
case ${GLSL_VER} in
|
|
||||||
1*|2*) gl="off";;
|
|
||||||
*) gl="on";;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
gl="on"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${PUBLIC}" ]; then
|
|
||||||
PUBLIC="${public_dir}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${PUBLIC}" == "none" ]; then
|
if [ "${PUBLIC}" == "none" ]; then
|
||||||
PUBLIC=""
|
PUBLIC=""
|
||||||
else
|
else
|
||||||
|
|
@ -1860,16 +1844,6 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
|
||||||
PUBLIC_PERMS=$(ls -ld "${PUBLIC}" | cut -d' ' -f1)
|
PUBLIC_PERMS=$(ls -ld "${PUBLIC}" | cut -d' ' -f1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${ssh_port}" ] && ! is_numeric "${ssh_port}"; then
|
|
||||||
echo "ERROR: ssh_port must be a number!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "${spice_port}" ] && ! is_numeric "${spice_port}"; then
|
|
||||||
echo "ERROR: spice_port must be a number!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if vm is already run
|
# Check if vm is already run
|
||||||
VM_PID=""
|
VM_PID=""
|
||||||
if [ -r "${VMDIR}/${VMNAME}.pid" ]; then
|
if [ -r "${VMDIR}/${VMNAME}.pid" ]; then
|
||||||
|
|
@ -1881,18 +1855,6 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${tpm}" == "on" ]; then
|
|
||||||
SWTPM=$(command -v swtpm)
|
|
||||||
if [ ! -e "${SWTPM}" ]; then
|
|
||||||
echo "ERROR! TPM is enabled, but swtpm was not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "ERROR! Virtual machine configuration not found."
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${VM_PID}" ]; then
|
if [ -z "${VM_PID}" ]; then
|
||||||
#TODO: double quote the args array to prevent word splitting and this can be removed
|
#TODO: double quote the args array to prevent word splitting and this can be removed
|
||||||
# Fix failing to start VM with spaces in the path
|
# Fix failing to start VM with spaces in the path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue