1 | #!/bin/sh |
---|
2 | # postinst script for debathena-cluster-login-config |
---|
3 | # |
---|
4 | # see: dh_installdeb(1) |
---|
5 | |
---|
6 | set -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 | |
---|
23 | package=debathena-cluster-login-config |
---|
24 | ours=.debathena |
---|
25 | theirs=.debathena-orig |
---|
26 | |
---|
27 | undivert_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 | |
---|
41 | undivert_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 | |
---|
51 | undivert_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 | |
---|
64 | cleanup_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 | |
---|
71 | rm_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 | |
---|
79 | case "$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 | # We set this true in earlier versions, before settings were |
---|
150 | # undone in the prerm script, but we want it unset now. |
---|
151 | $gcunset /desktop/gnome/lockdown/disable_user_switching |
---|
152 | |
---|
153 | # Set up gconf defaults. |
---|
154 | gcsrc=xml:readwrite:/etc/gconf/gconf.xml.defaults |
---|
155 | gc="gconftool-2 --direct --config-source=$gcsrc --set" |
---|
156 | $gc -t string \ |
---|
157 | /desktop/gnome/session/required_components/windowmanager \ |
---|
158 | "metacity" |
---|
159 | |
---|
160 | cat >>/etc/sudoers <<EOF |
---|
161 | ### BEGIN debathena-cluster-login-config |
---|
162 | ALL !ALL=!ALL |
---|
163 | %admin ALL=(ALL) ALL |
---|
164 | ### END debathena-cluster-login-config |
---|
165 | EOF |
---|
166 | |
---|
167 | exit 0 |
---|
168 | ;; |
---|
169 | |
---|
170 | abort-upgrade|abort-remove|abort-deconfigure) |
---|
171 | ;; |
---|
172 | |
---|
173 | *) |
---|
174 | echo "postinst called with unknown argument \`$1'" >&2 |
---|
175 | exit 1 |
---|
176 | ;; |
---|
177 | esac |
---|