1 | #!/bin/sh |
---|
2 | |
---|
3 | # Top level Xsession file for all users |
---|
4 | # |
---|
5 | # $Id: Xsession,v 1.8 2005-12-22 14:54:17 rbasch Exp $ |
---|
6 | |
---|
7 | trap "kdestroy; unlog; fsid -u -f $USER; exit 0" 1 2 15 |
---|
8 | |
---|
9 | initlib="/usr/athena/lib/init" |
---|
10 | defsession=$1 |
---|
11 | defsessioncmd="$2" |
---|
12 | |
---|
13 | if [ -f .noignore ]; then |
---|
14 | defsession=1; |
---|
15 | fi |
---|
16 | |
---|
17 | case $defsession in |
---|
18 | 1|4|7) |
---|
19 | if [ -f .xsession ]; then |
---|
20 | session=".xsession" |
---|
21 | else |
---|
22 | session="$initlib/xsession" |
---|
23 | fi |
---|
24 | case $defsession in |
---|
25 | 7) |
---|
26 | session="$session dash" |
---|
27 | ;; |
---|
28 | esac |
---|
29 | ;; |
---|
30 | 2) |
---|
31 | session="$initlib/xsession -nocalls" |
---|
32 | ;; |
---|
33 | 3) |
---|
34 | session="xterm -ls -geometry 80x24+280+220 -display :0.0" |
---|
35 | ;; |
---|
36 | 5) |
---|
37 | session="$defsessioncmd" |
---|
38 | ;; |
---|
39 | esac |
---|
40 | |
---|
41 | # Set the tty characteristics of the parent (console window) |
---|
42 | # Redirect stdin since some versions of stty use it instead of stdout. |
---|
43 | if [ "${hosttype}" = "decmips" ]; then |
---|
44 | stty dec 0<&1 2>/dev/null |
---|
45 | else |
---|
46 | stty sane 0<&1 2>/dev/null |
---|
47 | fi |
---|
48 | |
---|
49 | # Make random Athena modifications to keymap if required. |
---|
50 | |
---|
51 | test -f /usr/athena/lib/X11/keymaps/AthenaMods && \ |
---|
52 | xmodmap /usr/athena/lib/X11/keymaps/AthenaMods |
---|
53 | |
---|
54 | # Set X screensaver to noblanking to avoid power saving. |
---|
55 | xset s noblank |
---|
56 | |
---|
57 | # Create a unique temporary directory for the session, and remember |
---|
58 | # the directory name in the environment. |
---|
59 | sessiondir="`$initlib/mksessiondir -s $$`" |
---|
60 | if [ -n "$sessiondir" ]; then |
---|
61 | ATHENA_SESSION_TMPDIR="$sessiondir" |
---|
62 | export ATHENA_SESSION_TMPDIR |
---|
63 | fi |
---|
64 | |
---|
65 | # Only attempt using bugme if packs are actually available. |
---|
66 | if [ -x /usr/athena/bin/bugme ]; then |
---|
67 | /usr/athena/bin/bugme $session |
---|
68 | else |
---|
69 | $session |
---|
70 | fi |
---|
71 | |
---|
72 | status=$? |
---|
73 | if [ $status != 0 ]; then |
---|
74 | echo ERROR: |
---|
75 | echo "Xsession returned non-zero status." |
---|
76 | echo "" |
---|
77 | echo 'Select the login option to "Ignore your customizations"' |
---|
78 | echo 'to login and repair your dot files.' |
---|
79 | kdestroy # destroy tickets. |
---|
80 | sleep 10 |
---|
81 | exit 1 |
---|
82 | fi |
---|
83 | |
---|
84 | # Kill mozilla before destroying tokens so that it removes its lock file. |
---|
85 | $initlib/xkill-mozilla |
---|
86 | |
---|
87 | # Make gconfd flush settings to disk before destroying credentials. |
---|
88 | gconftool-2 --shutdown |
---|
89 | |
---|
90 | # Kill xscreensaver, to keep it from trying to restart when we send |
---|
91 | # it SIGHUP below. |
---|
92 | xscreensaver-command -exit > /dev/null 2>&1 |
---|
93 | |
---|
94 | # Cannot detach homedir here, since this script is executed in the users |
---|
95 | # homedir. |
---|
96 | |
---|
97 | kdestroy # destroy tickets. |
---|
98 | cd /tmp |
---|
99 | unlog |
---|
100 | fsid -u -f $USER > /dev/null 2>&1 |
---|
101 | |
---|
102 | sleep 3 # let them see any messages (quickly) |
---|
103 | exit 0 |
---|