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