Novi izvorni kod change_pass dodatka (inacica 3.0).
[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         need_restart=0
13         
14         # Remove CARNet configuration from /etc/hosts.allow and
15         # /etc/hosts.deny.
16         #
17         if [ -f /etc/hosts.allow ]; then
18                 cp-update -r "$PKG" /etc/hosts.allow
19         fi
20         if [ -f /etc/hosts.deny ]; then
21                 cp-update -r "$PKG" /etc/hosts.deny
22         fi
23
24         # Remove SquirrelMail change_pass plugin from SquirrelMail
25         # configuration.
26         #
27         SQCONF=/etc/squirrelmail/config.php
28
29         if egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
30                 cp_echo "CN: Disabling SquirrelMail change_pass plugin in $SQCONF"
31                 /usr/sbin/squirrelmail-configure --remove-plugin change_pass
32         fi
33
34         # Remove poppassd service from xinetd.
35         #
36         if [ -f /etc/xinetd.d/poppassd ]; then
37         
38                 if egrep -q "^# Begin update by CARNet package " /etc/xinetd.d/poppassd; then
39                 
40                         cp_echo "CN: Removing poppassd service from xinetd configuration"
41                         rm -f /etc/xinetd.d/poppassd
42                         need_restart=1
43                 fi
44         fi
45
46         # Restart xinetd if needed.
47         #
48         if [ $need_restart -eq 1 ]; then
49
50             if [ -x "/etc/init.d/xinetd" ]; then
51                 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
52                         invoke-rc.d xinetd restart || exit $?
53                 else
54                         /etc/init.d/xinetd restart || exit $?
55                 fi
56             fi
57         fi
58         
59         # Mail root.
60         #
61         cp_mail "$PKG"
62
63         break
64         ;;
65   upgrade)
66         :
67         ;;
68   failed-upgrade)
69         ;;
70   *)
71         echo "prerm called with unknown argument \$1'" >&2
72         exit 0
73         ;;
74 esac
75
76 exit 0