source: trunk/debathena/debathena/kiosk/launch-kiosk @ 25548

Revision 25548, 1.3 KB checked in by jdreed, 13 years ago (diff)
In kiosk: * Add a gconf-tree.xml to prevent [redacted] (Trac: 1130) * Tweak wording on home page.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# Start an X server for the kiosk user on an available VT.
4
5if [ "$(id -u)" -ne 0 ]; then
6  echo "You must be root to launch kiosk mode." 1>&2
7  exit 1
8fi
9
10datadir=/usr/share/debathena-kiosk
11kiosk_user=kiosk@mit
12kiosk_group=nogroup
13kiosk_home="/home/$kiosk_user"
14kiosk_vt_file=/var/run/athena-kiosk-vt
15display=99
16unset XAUTHORITY
17
18# See if we already have a running kiosk session.
19kiosk_vt=$(cat "$kiosk_vt_file" 2>/dev/null)
20if [ -n "$kiosk_vt" ]; then
21  chvt "$kiosk_vt" && exit 0
22fi
23
24# Get the VT to use.
25kiosk_vt=$(fgconsole --next-available)
26if [ -z "$kiosk_vt" ]; then
27  echo "$0: No available VTs" 1>&2
28  exit 1
29fi
30
31# Remember that we have allocated a VT for a kiosk session.
32echo "$kiosk_vt" > "$kiosk_vt_file"
33
34# Set up the kiosk user home directory.
35rm -rf "$kiosk_home"
36mkdir "$kiosk_home"
37cp "$datadir/xinitrc" "$kiosk_home/.xinitrc"
38mkdir "$kiosk_home/.gconf"
39cp "$datadir/%gconf-tree.xml" "$kiosk_home/.gconf/"
40chown -R "$kiosk_user":"$kiosk_group" "$kiosk_home"
41
42# Launch the session on our VT, and wait for it to complete.  This will
43# switch back to the current VT upon completion.
44openvt -c "$kiosk_vt" -s -w -- su -s /bin/sh -c "startx -- :$display -br \
45  -audit 0 -nolisten tcp vt$kiosk_vt" "$kiosk_user"
46
47# Ensure that the VT is deallocated.
48deallocvt "$kiosk_vt" > /dev/null 2>&1
49rm -f "$kiosk_vt_file"
50
51rm -f "$kiosk_home/.Xauthority"
Note: See TracBrowser for help on using the repository browser.