summaryrefslogtreecommitdiffstats
path: root/core/modules/xscreensaver/data/opt/openslx/pvs2/lockDesktop.sh
blob: 962af78e2fc8e3d763b534c8d5fd87ae07bc0404 (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
31
#!/bin/ash

# Cannot lock guest session, as the user probably doesn't know
# demo's password
if [ "$GUEST_SESSION" = "True" ]; then
	xmessage "Gastsitzungen koennen nicht gesperrt werden."
	exit 0
fi

# Browser-based login sessions cannot be unlocked for technical reasons,
# so disallow locking
[ -z "$UID" ] && UID="$( id -u )"
usrname="$( < "/etc/passwd"  awk -v "uid=$UID" -F ':' '$3 == uid {print $5; exit}' )"
# Yes, this really checks if $usrname ends in @browser, and sets NEVER_LOCK to true if so
if [ "${usrname%"@browser"}" != "${usrname}" ]; then
	xmessage "Web-Basierte Logins koennen die Sitzung leider nicht sperren."
	exit 0
fi

# Don't allow locking in exam mode
. /opt/openslx/config
if [ -n "$SLX_EXAM" ]; then
	xmessage "Im Pruefungsmodus nicht moeglich"
	exit 0
fi

# Any mouse-ungrab logic is embedded in our modded xscreensaver now,
# via external ungrab script

xscreensaver-command --lock