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

Revision 23865, 1.3 KB checked in by rbasch, 15 years ago (diff)
Add the debathena-kiosk package.
  • 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
10libdir=/usr/lib/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 "$libdir/xinitrc" "$kiosk_home/.xinitrc"
38chown -R "$kiosk_user":"$kiosk_group" "$kiosk_home"
39
40# Launch the session on our VT, and wait for it to complete.  This will
41# switch back to the current VT upon completion.
42openvt -c "$kiosk_vt" -s -w -- su -s /bin/sh -c "startx -- :$display -br \
43  -audit 0 -nolisten tcp vt$kiosk_vt" "$kiosk_user"
44
45# Ensure that the VT is deallocated.
46deallocvt "$kiosk_vt" > /dev/null 2>&1
47rm -f "$kiosk_vt_file"
48
49rm -f "$kiosk_home/.Xauthority"
Note: See TracBrowser for help on using the repository browser.