source: trunk/debathena/config/cluster-login-config/debian/debathena-cluster-login-config.postinst @ 24685

Revision 24685, 5.9 KB checked in by broder, 14 years ago (diff)
In cluster-login-config: * Disable user switching on Lucid by setting /desktop/gnome/lockdown/disable_user_switching again. (Trac: #496)
Line 
1#!/bin/sh
2# postinst script for debathena-cluster-login-config
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see http://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20
21#DEBHELPER#
22
23package=debathena-cluster-login-config
24ours=.debathena
25theirs=.debathena-orig
26
27undivert_unlink_symlink()
28{
29    file="$1"
30    ourfile="$2"
31    theirfile="$3"
32    if [ ! -L "$file" ] || \
33        [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \
34          "$(readlink "$file")" != "$(basename "$theirfile")" ]; then
35        echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2
36    else
37        rm -f "$file"
38    fi
39}
40
41undivert_unlink_divert()
42{
43    file="$1"
44    if [ ! -L "$file" ] && [ ! -e "$file" ]; then
45        dpkg-divert --remove --rename --package "$package" "$file"
46    else
47        echo "Not removing diversion of $file by $package" >&2
48    fi
49}
50
51undivert_unlink()
52{
53    prefix=$1
54    suffix=$2
55
56    file=$prefix$suffix
57    ourfile=$prefix$ours$suffix
58    theirfile=$prefix$theirs$suffix
59
60    undivert_unlink_symlink "$file" "$ourfile" "$theirfile"
61    undivert_unlink_divert "$file" "$package"
62}
63
64cleanup_old_diversion() {
65    file="$1"
66    if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${file}${theirs} by ${package}"; then
67        undivert_unlink "$file"
68    fi
69}
70
71rm_conffile() {
72    local PKGNAME="$1" # Unused
73    local CONFFILE="$2"
74    if [ -f "$CONFFILE".dpkg-del ]; then
75        rm -f "$CONFFILE".dpkg-del
76    fi
77}
78
79case "$1" in
80    configure)
81        gdm_version="$(dpkg-query -W -f '${Version}' gdm)"
82        if dpkg --compare-versions "$gdm_version" ge '2.25.2~'; then
83            cleanup_old_diversion /etc/gdm/gdm.conf.debathena
84            cleanup_old_diversion /etc/gdm/gdm.conf-custom.debathena
85        fi
86
87        if dpkg --compare-versions "$2" lt 1.24~; then
88            rm_conffile debathena-cluster-login-config "/etc/event.d/ttymsg"
89            rm_conffile debathena-cluster-login-config "/etc/init/ttymsg.conf"
90        fi
91
92        # Shut down sshd and reload gdm.
93        if hash invoke-rc.d; then
94            invoke-rc.d ssh stop
95            invoke-rc.d gdm reload || true
96        else
97            /etc/init.d/ssh stop
98            /etc/init.d/gdm reload || true
99        fi
100
101        # Make sure the gettys are running
102        initctl stop ttymsg >/dev/null 2>&1 || true
103        for i in $(seq 1 6); do
104            initctl stop "tty$i" >/dev/null 2>&1 || true
105            initctl start "tty$i" >/dev/null 2>&1 || true
106        done
107
108        # Configure dns-nameservers if they're not there
109        if ! egrep -q '^[[:space:]]+dns-nameservers' /etc/network/interfaces; then
110            echo '  dns-nameservers 18.70.0.160 18.71.0.151 18.72.0.3' >>/etc/network/interfaces
111            /usr/share/update-notifier/notify-reboot-required
112        fi
113
114        # Attempt to initially set the root password.
115        /usr/sbin/athena-root-password
116
117        # Set mandatory gconf key values.
118        gcsrc=xml:readwrite:/etc/gconf/gconf.xml.mandatory
119        gc="gconftool-2 --direct --config-source=$gcsrc --set"
120        gcunset="gconftool-2 --direct --config-source=$gcsrc --unset"
121
122        # gnome-screensaver
123        $gc -t bool /apps/gnome-screensaver/logout_enabled true
124        $gc -t int /apps/gnome-screensaver/logout_delay 20
125        $gc -t string /apps/gnome-screensaver/logout_command \
126            "/usr/bin/gnome-session-save --force-logout"
127        # KLUDGE: gnome-screensaver can overwrite its internal
128        # logout_command setting with the embedded_keyboard_command
129        # value (http://bugzilla.gnome.org/show_bug.cgi?id=573495).
130        # So work around the problem by setting the latter to the same
131        # value as the former.  This should be removed after the bug
132        # has been fixed.  Also disable the embedded_keyboard to ensure
133        # that this value is not used otherwise.
134        $gc -t string /apps/gnome-screensaver/embedded_keyboard_command \
135            "/usr/bin/gnome-session-save --force-logout"
136        $gc -t bool /apps/gnome-screensaver/embedded_keyboard_enabled false
137        $gc -t bool /apps/gnome-screensaver/user_switch_enabled false
138        $gc -t bool /apps/gnome-screensaver/lock_enabled true
139        $gc -t int /apps/gnome-screensaver/lock_delay 1
140
141        # fast-user-switch-applet
142        $gc -t bool /apps/fast-user-switch-applet/show_active_users_only true
143        $gc -t bool /apps/fast-user-switch-applet/show_guest_login false
144
145        # gnome-power-manager
146        $gc -t bool /apps/gnome-power-manager/general/can_hibernate false
147        $gc -t bool /apps/gnome-power-manager/general/can_suspend false
148
149        # This should be set to true on systems using
150        # indicator-applet-session, and false on systems that don't
151        # (i.e. those still using fast-user-switch-agent)
152        #
153        # (This setting completely disables fast-user-switch-applet,
154        # which provides the logout button, but is the only clean way
155        # to disable user switching as of indicator-applet-session
156        # 0.2.2)
157        if dpkg-query -f '${Status}' -W indicator-applet-session 2>/dev/null | grep -q 'install ok installed'; then
158            $gc -t bool /desktop/gnome/lockdown/disable_user_switching true
159        else
160            $gcunset /desktop/gnome/lockdown/disable_user_switching
161        fi
162
163        # Set up gconf defaults.
164        gcsrc=xml:readwrite:/etc/gconf/gconf.xml.defaults
165        gc="gconftool-2 --direct --config-source=$gcsrc --set"
166        $gc -t string \
167            /desktop/gnome/session/required_components/windowmanager \
168            "metacity"
169
170        cat >>/etc/sudoers <<EOF
171### BEGIN debathena-cluster-login-config
172ALL !ALL=!ALL
173%admin ALL=(ALL) ALL
174### END debathena-cluster-login-config
175EOF
176
177        exit 0
178    ;;
179
180    abort-upgrade|abort-remove|abort-deconfigure)
181    ;;
182
183    *)
184        echo "postinst called with unknown argument \`$1'" >&2
185        exit 1
186    ;;
187esac
Note: See TracBrowser for help on using the repository browser.