Prilagodba paketa za Debian squeeze.
[squirrelmail-change-pass-cn.git] / debian / prerm
1 #!/bin/sh
2
3 set -e
4
5 case "$1" in
6   remove|deconfigure)
7
8     # Include CARNet functions
9     . /usr/share/carnet-tools/functions.sh
10
11     PKG="squirrelmail-change-pass-cn"
12     SQCONFDIR="/etc/squirrelmail"
13     SQCONF="$SQCONFDIR/config.php"
14     need_restart=0
15
16     # Remove CARNet configuration from /etc/hosts.allow and
17     # /etc/hosts.deny.
18     #
19     if [ -f /etc/hosts.allow ]; then
20         cp-update -r "$PKG" /etc/hosts.allow
21     fi
22     if [ -f /etc/hosts.deny ]; then
23         cp-update -r "$PKG" /etc/hosts.deny
24     fi
25
26     # Remove SquirrelMail change_pass plugin from SquirrelMail
27     # configuration.
28     #
29     if egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
30         squirrelmail-configure --remove-plugin change_pass
31     fi
32
33     # Remove poppassd service from xinetd.
34     #
35     if [ -f /etc/xinetd.d/poppassd ]; then
36         if egrep -q "^# Begin update by CARNet package " /etc/xinetd.d/poppassd; then
37             cp_echo "CN: Removing poppassd service from xinetd configuration"
38             rm -f /etc/xinetd.d/poppassd
39             need_restart=1
40         fi
41     fi
42
43     # Restart xinetd if needed.
44     #
45     if [ $need_restart -eq 1 ]; then
46         if [ -x "/etc/init.d/xinetd" ]; then
47             if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
48                     invoke-rc.d xinetd restart || exit $?
49             else
50                     /etc/init.d/xinetd restart || exit $?
51             fi
52         fi
53     fi
54
55     # Mail root.
56     #
57     cp_mail "$PKG"
58
59     break
60     ;;
61   upgrade)
62     :
63     ;;
64   failed-upgrade)
65     ;;
66   *)
67     echo "prerm called with unknown argument \$1'" >&2
68     exit 0
69     ;;
70 esac
71
72 #DEBHELPER#
73
74 exit 0