Skip to content

Commit

Permalink
slight optimization of pve connection script including usbredir
Browse files Browse the repository at this point in the history
statements.
  • Loading branch information
jens-maus committed Jul 31, 2024
1 parent e06ec37 commit 0dff0df
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif()
project(qutselect)
set(PROJECT_LONGNAME "qutselect")
set(PROJECT_VERSION_MAJOR 3)
set(PROJECT_VERSION_MINOR 2)
set(PROJECT_VERSION_MINOR 3)
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})

# change output directory to top-level 'bin' dir.
Expand Down
4 changes: 2 additions & 2 deletions qutselect.slist
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ UKD-NUK ; termserver ; UKD88 ; RDP ; Windows ; UKD - Med
===
WWW-Browser ; firefox ; ; APP ; Firefox ; Firefox ; FALSE ; scripts/qutselect_connect_app.sh
===
FWPVM40 ; fwpvm40 ; fwppve.fz-rossendorf.de ; PVE ; Windows ; VDI ; TRUE ; scripts/qutselect_connect_pve.sh
FWP112VM ; fwp112vm ; 149.220.72.17:8006 ; PVE ; Windows ; VDI ; TRUE ; scripts/qutselect_connect_pve.sh
FWPVM40 ; fwpvm40 ; fwppve.fz-rossendorf.de:443 ; PVE ; Windows ; VDI ; TRUE ; scripts/qutselect_connect_pve.sh
FWP112VM ; fwp112vm ; fwp112 ; PVE ; Windows ; VDI ; TRUE ; scripts/qutselect_connect_pve.sh
26 changes: 22 additions & 4 deletions scripts/qutselect_connect_pve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ fi

# fallback to fwppve.fz-rossendorf.de as PVE proxy
if [[ -z ${proxy} ]] || [[ "${proxy}" == "NULL" ]]; then
proxy=fwppve.fz-rossendorf.de
proxy="fwppve.fz-rossendorf.de:443"
fi

# if no port has been explicity specified we add the
# standard PVE port (8006)
if [[ ! ${proxy} =~ ":" ]]; then
proxy="${proxy}:8006"
fi

# read the password from stdin if not specified yet
Expand Down Expand Up @@ -180,6 +186,13 @@ if [[ "${dtlogin}" == "true" ]]; then
SPICE_FULLSCREEN=
SPICE_CURSOR=
cmdArgs="${cmdArgs} --kiosk --kiosk-quit=on-disconnect"

# Define USB redirection rule when in dtlogin/kiosk mode
# (0x03) - no HID devices / mouse/keyboard
# (0xE0) - no wireless/bluetooth
# (-1) - all the rest allowed
USBREDIR="0x03,-1,-1,-1,0|0xE0,-1,-1,-1,0|-1,-1,-1,-1,1"
cmdArgs="${cmdArgs} --spice-usbredir-auto-redirect-filter=${USBREDIR} --spice-usbredir-redirect-on-connect=${USBREDIR}"
fi

# GENERATE REMOTE-VIEWER CONNECTION FILE
Expand All @@ -192,17 +205,22 @@ delete-this-file=${SPICE_DELETE}
proxy=${SPICE_PROXY}
type=${SPICE_TYPE}
ca=${SPICE_CA}
toggle-fullscreen=${SPICE_FULLSCREEN}
title=${SPICE_TITLE}
host=${SPICE_HOST}
password=${SPICE_PASSWORD}
host-subject=${SPICE_SUBJECT}
release-cursor=${SPICE_CURSOR}
tls-port=${SPICE_PORT}
EOL

if [[ -n "${SPICE_FULLSCREEN}" ]]; then
echo "toggle-fullscreen=${SPICE_FULLSCREEN}" >>"${TMPFILE}"
fi
if [[ -n "${SPICE_CURSOR}" ]]; then
echo "release-cursor=${SPICE_CURSOR}" >>"${TMPFILE}"
fi

# shellcheck disable=SC2086
${REMOTEVIEWER} ${cmdArgs} "${TMPFILE}" &
${REMOTEVIEWER} ${cmdArgs} --verbose "${TMPFILE}" >/tmp/remote-viewer-${USER}-$$.log 2>&1 &
res=$?

if [[ ${res} != 0 ]]; then
Expand Down

0 comments on commit 0dff0df

Please sign in to comment.