summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-10-10 19:37:42 +0200
committerSimon Rettberg2016-10-10 19:37:42 +0200
commit786df0669f73375d4bf5703c422e910839b7717f (patch)
treea8a9340b5ffe652a401218eca37e417d2ac6827f
parent[run-virt/udhcpc] Fix passing on domain suffix and search domains to VMs via ... (diff)
downloadtm-scripts-786df0669f73375d4bf5703c422e910839b7717f.tar.gz
tm-scripts-786df0669f73375d4bf5703c422e910839b7717f.tar.xz
tm-scripts-786df0669f73375d4bf5703c422e910839b7717f.zip
[pvs2] Use command line option for config file location; use new client side exam mode config
-rwxr-xr-xremote/modules/pvs2/data/opt/openslx/bin/pvsstartup9
-rwxr-xr-xremote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr9
-rwxr-xr-xremote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr10
-rwxr-xr-xremote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient21
4 files changed, 30 insertions, 19 deletions
diff --git a/remote/modules/pvs2/data/opt/openslx/bin/pvsstartup b/remote/modules/pvs2/data/opt/openslx/bin/pvsstartup
index dc7bd48a..16a01708 100755
--- a/remote/modules/pvs2/data/opt/openslx/bin/pvsstartup
+++ b/remote/modules/pvs2/data/opt/openslx/bin/pvsstartup
@@ -4,15 +4,14 @@ timediff=5
counter=0
. /opt/openslx/config
-if [ -n "$SLX_PVS_CONFIG_URL" ]; then
- [ -z "$UID" ] && UID="$(id -u)"
- [ -z "$HOME" ] && HOME="$(getent passwd "$UID" | head -n 1 | awk -F ':' '{print $6}')"
- wget -O "$HOME/.config/openslx/pvs2/pvs2.ini" "$SLX_PVS_CONFIG_URL"
+EXAM=
+if [ -n "$SLX_EXAM" ]; then
+ EXAM="--exam-mode"
fi
while [ $timediff -gt 3 ]; do
start="$(date +%s)"
- pvsclient "$@"
+ pvsclient $EXAM "$@"
ret=$?
end="$(date +%s)"
/opt/openslx/pvs2/kb-unlock.sh
diff --git a/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr b/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr
index f39e03aa..be44e87e 100755
--- a/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr
+++ b/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr
@@ -1,5 +1,14 @@
#!/bin/ash
+. /opt/openslx/config
+DST="/opt/openslx/pvs2/pvs2.ini"
+
+# Try to get fresh version from server
+if [ -n "$SLX_PVS_CONFIG_URL" ]; then
+ wget -T 5 -O "${DST}.new" "$SLX_PVS_CONFIG_URL"
+ [ -s "${DST}.new" ] && mv -f "${DST}.new" "${DST}"
+fi
+
openbox &
exec /opt/openslx/bin/pvsmgr "$@"
diff --git a/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr b/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr
index 34ae61d5..1a56e8d0 100755
--- a/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr
+++ b/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr
@@ -5,18 +5,10 @@ DST="/opt/openslx/pvs2/pvs2.ini"
# Try to get fresh version from server
if [ -n "$SLX_PVS_CONFIG_URL" ]; then
- wget -O "${DST}.new" "$SLX_PVS_CONFIG_URL"
+ wget -T 10 -O "${DST}.new" "$SLX_PVS_CONFIG_URL"
[ -s "${DST}.new" ] && mv -f "${DST}.new" "${DST}"
fi
-# Patch exam mode according to what our fetched config says
-if [ -n "$SLX_EXAM" ]; then
- EMODE=True
-else
- EMODE=False
-fi
-sed -i "/^examMode/d;/^\\[General\\]/a examMode=$EMODE" "$DST"
-
# If this is a dedicated PVS station, make it launch right away
if [ -n "$SLX_PVS_DEDICATED" ] && cd /opt/openslx/xsessions; then
for file in *.desktop; do
diff --git a/remote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient b/remote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient
index a2d56049..5ff03227 100755
--- a/remote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient
+++ b/remote/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient
@@ -18,18 +18,29 @@ if [ -n "${PVSMGR_SESSION_CMD}" ]; then
[ "x${SESSION_CMD}" == "x${PVSMGR_SESSION_CMD}" ] && exit 0
fi
+# Download fresh copy of config file if possible
. /opt/openslx/config
+PVSCONFIG=
if [ -n "$SLX_PVS_CONFIG_URL" ]; then
[ -z "$UID" ] && UID="$(id -u)"
[ -z "$HOME" ] && HOME="$(getent passwd "$UID" | head -n 1 | awk -F ':' '{print $6}')"
- wget -O "$HOME/.config/openslx/pvs2/pvs2.ini" "$SLX_PVS_CONFIG_URL"
+ mkdir -p "$HOME/.tmp"
+ if wget -T 5 -O "$HOME/.tmp/pvs2.ini.tmp" "$SLX_PVS_CONFIG_URL"; then
+ mv -f "$HOME/.tmp/pvs2.ini.tmp" "$HOME/.tmp/pvs2.ini"
+ fi
+ if ! [ -s "$HOME/.tmp/pvs2.ini" ] && [ -s "/opt/openslx/pvs2/pvs2.ini" ]; then
+ cp -f "/opt/openslx/pvs2/pvs2.ini" "$HOME/.tmp/pvs2.ini"
+ fi
+ if [ -s "$HOME/.tmp/pvs2.ini" ]; then
+ PVSCONFIG="--config=$HOME/.tmp/pvs2.ini"
+ fi
fi
# If the ENV var PVS has been set by vmchooser start pvsclient
if [ "$PVS_AUTO_CONNECT" == "TRUE" ]; then
- pvsstartup --auto &
+ pvsstartup "$PVSCONFIG" --auto &
else
- pvsstartup &
+ pvsstartup "$PVSCONFIG" &
fi
# Finally, handle hybrid mode where the pvsmgr is launched on the second desktop
@@ -37,8 +48,8 @@ fi
if [ "$SESSION_TYPE" == "VSESSION" ]; then
{
wt="PVS2-Manager"
- pvsmgr --manager-only &
- for i in 250 250 500 500 1000; do
+ pvsmgr "$PVSCONFIG" --manager-only &
+ for i in 100 100 200 200 200 300 500 500 1000; do
usleep $(( i * 1000 )) || sleep 1
wmctrl -r "$wt" -t 1
done