Add "--access" variable to toggle on remote Spice access

Add "--access" variable to toggle on remote Spice access
This commit is contained in:
colino17 2023-11-07 18:43:35 -04:00 committed by Martin Wimpress
parent 2a5067f277
commit ca7faf6fad
1 changed files with 20 additions and 2 deletions

View File

@ -848,6 +848,19 @@ function vm_boot() {
SPICE_PORT=$(get_port 5930 9)
fi
# ALLOW REMOTE ACCESS TO SPICE OVER LAN RATHER THAN JUST LOCALHOST
if [ -z "${ACCESS}" ]; then
SPICE_ADDR="127.0.0.1"
else
if [ "${ACCESS}" == "remote" ]; then
SPICE_ADDR=""
elif [ "${ACCESS}" == "local" ]; then
SPICE_ADDR="127.0.0.1"
else
SPICE_ADDR="${ACCESS}"
fi
fi
if [ -z "${SPICE_PORT}" ]; then
echo " - SPICE: All SPICE ports have been exhausted."
if [ "${OUTPUT}" == "none" ] || [ "${OUTPUT}" == "spice" ] || [ "${OUTPUT}" == "spice-app" ]; then
@ -864,7 +877,7 @@ function vm_boot() {
echo -n " --spice-shared-dir ${PUBLIC}"
fi
echo "${FULLSPICY}"
SPICE="${SPICE},port=${SPICE_PORT},addr=127.0.0.1"
SPICE="${SPICE},port=${SPICE_PORT},addr=${SPICE_ADDR}"
fi
fi
fi
@ -1231,7 +1244,6 @@ function vm_boot() {
exit 1
fi
if [ -z "${EXTRA_ARGS}" ]; then
EXTRA_ARGS="${extra_args}"
fi
@ -1326,6 +1338,7 @@ function usage() {
echo " ${LAUNCHER} --vm ubuntu.conf"
echo
echo "You can also pass optional parameters"
echo " --access : Select whether to enable remote spice access. 'local' (default), 'remote' 'clientipaddress'"
echo " --braille : Enable braille support. Requires SDL."
echo " --delete-disk : Delete the disk image and EFI variables"
echo " --delete-vm : Delete the entire VM and it's configuration"
@ -1498,6 +1511,7 @@ mouse="tablet"
# options: intel-hda, ac97, es1370, sb16, none
sound_card="intel-hda"
ACCESS=""
BRAILLE=""
DELETE_DISK=0
DELETE_VM=0
@ -1564,6 +1578,10 @@ if [ $# -lt 1 ]; then
else
while [ $# -gt 0 ]; do
case "${1}" in
-access|--access)
ACCESS="${2}"
shift
shift;;
-braille|--braille)
BRAILLE="on"
shift;;