summaryrefslogtreecommitdiffstats
path: root/remote/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr
blob: 34ae61d5de9c11d00d0705efde0edd0ec6766802 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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