diff options
| author | Simon Rettberg | 2016-09-08 12:34:05 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2016-09-08 12:34:05 +0200 |
| commit | 6eea8f48ac415be6208ffb55167b67a539874ac4 (patch) | |
| tree | bc320d527a2e62d8df2b2d6d07938426fc5c81d8 /remote/modules/pvs2/data/opt/openslx/scripts | |
| parent | [pvs2] Renamed lock/unlock scripts (diff) | |
| download | tm-scripts-6eea8f48ac415be6208ffb55167b67a539874ac4.tar.gz tm-scripts-6eea8f48ac415be6208ffb55167b67a539874ac4.tar.xz tm-scripts-6eea8f48ac415be6208ffb55167b67a539874ac4.zip | |
[pvs2] Support fetching remote pvs2.ini; honor exam mode, dedicated flag
Diffstat (limited to 'remote/modules/pvs2/data/opt/openslx/scripts')
| -rwxr-xr-x | remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr | 8 | ||||
| -rw-r--r-- | remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr | 30 |
2 files changed, 38 insertions, 0 deletions
diff --git a/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr b/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr index 7a6c13d9..f58ce099 100755 --- a/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr +++ b/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr @@ -1,4 +1,12 @@ #!/bin/ash openbox & + +. /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" +fi + exec /opt/openslx/bin/pvsmgr --manager-only diff --git a/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr b/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr new file mode 100644 index 00000000..34ae61d5 --- /dev/null +++ b/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr @@ -0,0 +1,30 @@ +#!/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 -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 + cp -f "/usr/share/xsessions/pvs2mgr.desktop" "$file" + done + # patch autologin into kdmrc + sed -i '/AutoLogin.*=/d;/^\[X-.*-Core\]/a AutoLoginEnable=true\nAutoLoginUser=demo\nAutoLoginAgain=true\nAutoLoginDelay=0' "/etc/kde/kdm/kdmrc" +fi + +exit 0 + |
