1 | #!/bin/sh |
---|
2 | # postinst script for debathena-reactivate |
---|
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 | package=debathena-reactivate |
---|
22 | ours=.debathena |
---|
23 | theirs=.debathena-orig |
---|
24 | |
---|
25 | undivert_unlink_symlink() |
---|
26 | { |
---|
27 | file="$1" |
---|
28 | ourfile="$2" |
---|
29 | theirfile="$3" |
---|
30 | if [ ! -L "$file" ] || \ |
---|
31 | [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \ |
---|
32 | "$(readlink "$file")" != "$(basename "$theirfile")" ]; then |
---|
33 | echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2 |
---|
34 | else |
---|
35 | rm -f "$file" |
---|
36 | fi |
---|
37 | } |
---|
38 | |
---|
39 | undivert_unlink_divert() |
---|
40 | { |
---|
41 | file="$1" |
---|
42 | if [ ! -L "$file" ] && [ ! -e "$file" ]; then |
---|
43 | dpkg-divert --remove --rename --package "$package" "$file" |
---|
44 | else |
---|
45 | echo "Not removing diversion of $file by $package" >&2 |
---|
46 | fi |
---|
47 | } |
---|
48 | |
---|
49 | undivert_unlink() |
---|
50 | { |
---|
51 | prefix=$1 |
---|
52 | suffix=$2 |
---|
53 | |
---|
54 | file=$prefix$suffix |
---|
55 | ourfile=$prefix$ours$suffix |
---|
56 | theirfile=$prefix$theirs$suffix |
---|
57 | |
---|
58 | undivert_unlink_symlink "$file" "$ourfile" "$theirfile" |
---|
59 | undivert_unlink_divert "$file" "$package" |
---|
60 | } |
---|
61 | |
---|
62 | cleanup_old_diversion() { |
---|
63 | file="$1" |
---|
64 | if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${file}${theirs} by ${package}"; then |
---|
65 | undivert_unlink "$file" |
---|
66 | fi |
---|
67 | } |
---|
68 | |
---|
69 | . /usr/lib/debathena-cupsys-config/restart-cups.sh |
---|
70 | |
---|
71 | if dpkg-maintscript-helper supports rm_conffile 2> /dev/null; then |
---|
72 | dpkg-maintscript-helper rm_conffile /etc/athena/sudo-error 2.0.39 -- "$@" |
---|
73 | dpkg-maintscript-helper rm_conffile /etc/athena/su-error 2.0.39 -- "$@" |
---|
74 | else |
---|
75 | # From http://wiki.debian.org/DpkgConffileHandling |
---|
76 | rm_conffile() { |
---|
77 | local PKGNAME="$1" # Unused |
---|
78 | local CONFFILE="$2" |
---|
79 | if [ -f "$CONFFILE".dpkg-del ]; then |
---|
80 | rm -f "$CONFFILE".dpkg-del |
---|
81 | fi |
---|
82 | } |
---|
83 | case "$1" in |
---|
84 | configure) |
---|
85 | if dpkg --compare-versions "$2" le-nl 2.0.39; then |
---|
86 | rm_conffile debathena-reactivate "/etc/athena/sudo-error" |
---|
87 | rm_conffile debathena-reactivate "/etc/athena/su-error" |
---|
88 | fi |
---|
89 | esac |
---|
90 | fi |
---|
91 | |
---|
92 | case "$1" in |
---|
93 | configure) |
---|
94 | # Users logging in will be added to several different |
---|
95 | # groups. Make sure they all exist. |
---|
96 | for group in $(sed -ne 's/^addgroups="\(.*\)"/\1/p' /etc/gdm/Xsession.debathena); do |
---|
97 | getent group "$group" >/dev/null || addgroup --system "$group" |
---|
98 | done |
---|
99 | cat >>/etc/sudoers <<EOF |
---|
100 | ### BEGIN debathena-reactivate |
---|
101 | Defaults:%admin lecture_file=/etc/athena/sudo-warning, lecture=once |
---|
102 | Defaults:%sudo lecture_file=/etc/athena/sudo-warning, lecture=once |
---|
103 | ### END debathena-reactivate |
---|
104 | EOF |
---|
105 | |
---|
106 | if dpkg --compare-versions "$2" lt 1.25.5~ && \ |
---|
107 | dpkg --compare-versions "$2" ge 1.25.2; then |
---|
108 | ln -nsf su.debathena /etc/pam.d/su |
---|
109 | fi |
---|
110 | |
---|
111 | cleanup_old_diversion /etc/gdm/PreSession/Default |
---|
112 | cleanup_old_diversion /etc/gdm/PostSession/Default |
---|
113 | |
---|
114 | if dpkg --compare-versions "$2" lt 2.0.26~ && \ |
---|
115 | [ -x /usr/share/update-notifier/notify-reboot-required ]; then |
---|
116 | /usr/share/update-notifier/notify-reboot-required |
---|
117 | fi |
---|
118 | |
---|
119 | # Make printing suck less |
---|
120 | restart_cups |
---|
121 | ;; |
---|
122 | |
---|
123 | abort-upgrade|abort-remove|abort-deconfigure) |
---|
124 | ;; |
---|
125 | |
---|
126 | *) |
---|
127 | echo "postinst called with unknown argument \`$1'" >&2 |
---|
128 | exit 1 |
---|
129 | ;; |
---|
130 | esac |
---|
131 | |
---|
132 | # dh_installdeb will replace this with shell code automatically |
---|
133 | # generated by other debhelper scripts. |
---|
134 | |
---|
135 | #DEBHELPER# |
---|
136 | |
---|
137 | exit 0 |
---|
138 | |
---|
139 | |
---|