Informacija korisniku ako je konfiguracija za plugin uklonjena.
[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         CPCONF="/usr/share/squirrelmail/plugins/change_pass/config.php"
15         need_restart=0
16         
17         # Remove CARNet configuration from /etc/hosts.allow and
18         # /etc/hosts.deny.
19         #
20         if [ -f /etc/hosts.allow ]; then
21                 cp-update -r "$PKG" /etc/hosts.allow
22         fi
23         if [ -f /etc/hosts.deny ]; then
24                 cp-update -r "$PKG" /etc/hosts.deny
25         fi
26
27         # Remove SquirrelMail change_pass plugin from SquirrelMail
28         # configuration.
29         #
30         if egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
31                 cp_echo "CN: Disabling SquirrelMail change_pass plugin in $SQCONF"
32                 /usr/sbin/squirrelmail-configure --remove-plugin change_pass
33         fi
34
35         # Backup change_pass configuration file (if any) and notify user.
36         #
37         if [ -f "$CPCONF" ]; then
38                 cp_echo "CN: Doing backup for $CPCONF"
39                 cp_backup_conffile -d "/var/backups/$PKG" -p $CPCONF
40                 cp_echo "CN: Backup is located in directory: /var/backups/$PKG/"
41                 rm -f $CPCONF
42                 rm -f $CPCONF.cn-old
43                 cp_echo "CN: Configuration for SquirrelMail change_pass plugin has been removed."
44         fi
45
46         # Remove poppassd service from xinetd.
47         #
48         if [ -f /etc/xinetd.d/poppassd ]; then
49         
50                 if egrep -q "^# Begin update by CARNet package " /etc/xinetd.d/poppassd; then
51                 
52                         cp_echo "CN: Removing poppassd service from xinetd configuration"
53                         rm -f /etc/xinetd.d/poppassd
54                         need_restart=1
55                 fi
56         fi
57
58         # Restart xinetd if needed.
59         #
60         if [ $need_restart -eq 1 ]; then
61
62             if [ -x "/etc/init.d/xinetd" ]; then
63                 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
64                         invoke-rc.d xinetd restart || exit $?
65                 else
66                         /etc/init.d/xinetd restart || exit $?
67                 fi
68             fi
69         fi
70         
71         # Mail root.
72         #
73         cp_mail "$PKG"
74
75         break
76         ;;
77   upgrade)
78         :
79         ;;
80   failed-upgrade)
81         ;;
82   *)
83         echo "prerm called with unknown argument \$1'" >&2
84         exit 0
85         ;;
86 esac
87
88 exit 0