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

Revision 25292, 6.6 KB checked in by jdreed, 13 years ago (diff)
In cluster-login-config: * Correctly punt the conffiles we removed in 1.36
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        if dpkg --compare-versions "$2" lt '1.36.2~'; then
93            # Cleanup from previous installs
94            # /etc/apt/preferences was frobbed due to (LP:508545)
95            if grep -qxF "Package: libstdc++5" /etc/apt/preferences 2>/dev/null; then
96                rm /etc/apt/preferences
97            fi
98            # Cleanup conffiles
99            rm_conffile debathena-cluster-login-config /etc/apt/sources.list.d/debathena-backports.list
100            rm_conffile debathena-cluster-login-config /etc/apt/preferences.d/debathena-libstdcplusplus.pref
101        fi
102
103        if dpkg --compare-versions "$2" lt 1.35.2~; then
104            update-grub
105        fi
106
107        # Shut down sshd and reload gdm.
108        if hash invoke-rc.d; then
109            invoke-rc.d ssh stop
110            invoke-rc.d gdm reload || true
111        else
112            /etc/init.d/ssh stop
113            /etc/init.d/gdm reload || true
114        fi
115
116        # Make sure the gettys are running
117        initctl stop ttymsg >/dev/null 2>&1 || true
118        for i in $(seq 1 6); do
119            initctl stop "tty$i" >/dev/null 2>&1 || true
120            initctl start "tty$i" >/dev/null 2>&1 || true
121        done
122
123        # Configure dns-nameservers if they're not there
124        if ! egrep -q '^[[:space:]]+dns-nameservers' /etc/network/interfaces; then
125            echo '  dns-nameservers 18.70.0.160 18.71.0.151 18.72.0.3' >>/etc/network/interfaces
126            /usr/share/update-notifier/notify-reboot-required
127        fi
128
129        # Attempt to initially set the root password.
130        /usr/sbin/athena-root-password
131
132        # Set mandatory gconf key values.
133        gcsrc=xml:readwrite:/etc/gconf/gconf.xml.mandatory
134        gc="gconftool-2 --direct --config-source=$gcsrc --set"
135        gcunset="gconftool-2 --direct --config-source=$gcsrc --unset"
136
137        # gnome-screensaver
138        $gc -t bool /apps/gnome-screensaver/logout_enabled true
139        $gc -t int /apps/gnome-screensaver/logout_delay 20
140        $gc -t string /apps/gnome-screensaver/logout_command \
141            "/usr/share/debathena-cluster-login-config/screensaver_logout.sh"
142        # KLUDGE: gnome-screensaver can overwrite its internal
143        # logout_command setting with the embedded_keyboard_command
144        # value (http://bugzilla.gnome.org/show_bug.cgi?id=573495).
145        # So work around the problem by setting the latter to the same
146        # value as the former.  This should be removed after the bug
147        # has been fixed.  Also disable the embedded_keyboard to ensure
148        # that this value is not used otherwise.
149        $gc -t string /apps/gnome-screensaver/embedded_keyboard_command \
150            "/usr/share/debathena-cluster-login-config/screensaver_logout.sh"
151        $gc -t bool /apps/gnome-screensaver/embedded_keyboard_enabled false
152        $gc -t bool /apps/gnome-screensaver/user_switch_enabled false
153        $gc -t bool /apps/gnome-screensaver/lock_enabled true
154        $gc -t int /apps/gnome-screensaver/lock_delay 1
155
156        # fast-user-switch-applet
157        $gc -t bool /apps/fast-user-switch-applet/show_active_users_only true
158        $gc -t bool /apps/fast-user-switch-applet/show_guest_login false
159
160        # gnome-power-manager
161        # As of Lucid, these are ignored and polkit is used instead
162        $gc -t bool /apps/gnome-power-manager/general/can_hibernate false
163        $gc -t bool /apps/gnome-power-manager/general/can_suspend false
164        # Change DPMS sleep time to 10 min
165        $gc -t int /apps/gnome-power-manager/timeout/sleep_display_ac 600
166
167        # This should be set to true on systems using
168        # indicator-applet-session, and false on systems that don't
169        # (i.e. those still using fast-user-switch-agent)
170        #
171        # (This setting completely disables fast-user-switch-applet,
172        # which provides the logout button, but is the only clean way
173        # to disable user switching as of indicator-applet-session
174        # 0.2.2)
175        if dpkg-query -f '${Status}' -W indicator-applet-session 2>/dev/null | grep -q 'install ok installed'; then
176            $gc -t bool /desktop/gnome/lockdown/disable_user_switching true
177        else
178            $gcunset /desktop/gnome/lockdown/disable_user_switching
179        fi
180
181        # Set up gconf defaults.
182        gcsrc=xml:readwrite:/etc/gconf/gconf.xml.defaults
183        gc="gconftool-2 --direct --config-source=$gcsrc --set"
184        $gc -t string \
185            /desktop/gnome/session/required_components/windowmanager \
186            "metacity"
187
188        cat >>/etc/sudoers <<EOF
189### BEGIN debathena-cluster-login-config
190ALL !ALL=!ALL
191%admin ALL=(ALL) ALL
192### END debathena-cluster-login-config
193EOF
194
195        exit 0
196    ;;
197
198    abort-upgrade|abort-remove|abort-deconfigure)
199    ;;
200
201    *)
202        echo "postinst called with unknown argument \`$1'" >&2
203        exit 1
204    ;;
205esac
Note: See TracBrowser for help on using the repository browser.