Ispravke vezane za Lintian upozorenja.
[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                 /usr/sbin/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         
37                 if egrep -q "^# Begin update by CARNet package " /etc/xinetd.d/poppassd; then
38                 
39                         cp_echo "CN: Removing poppassd service from xinetd configuration"
40                         rm -f /etc/xinetd.d/poppassd
41                         need_restart=1
42                 fi
43         fi
44
45         # Restart xinetd if needed.
46         #
47         if [ $need_restart -eq 1 ]; then
48
49             if [ -x "/etc/init.d/xinetd" ]; then
50                 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
51                         invoke-rc.d xinetd restart || exit $?
52                 else
53                         /etc/init.d/xinetd restart || exit $?
54                 fi
55             fi
56         fi
57         
58         # Mail root.
59         #
60         cp_mail "$PKG"
61
62         break
63         ;;
64   upgrade)
65         :
66         ;;
67   failed-upgrade)
68         ;;
69   *)
70         echo "prerm called with unknown argument \$1'" >&2
71         exit 0
72         ;;
73 esac
74
75 #DEBHELPER#
76
77 exit 0