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

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