Uklonjen dio za backupiranje change_pass konfiguracije.
[squirrelmail-change-pass-cn.git] / debian / postinst
1 #!/bin/sh
2
3 set -e
4
5 [ "$1" = "configure" ] || exit 0
6 [ $DEBIAN_SCRIPT_DEBUG ] && set -vx
7
8 # Include CARNet functions
9 . /usr/share/carnet-tools/functions.sh
10
11 PKG="squirrelmail-change-pass-cn"
12 VERSION="3.0.2"
13 SQCONFDIR="/etc/squirrelmail"
14 SQCONF="$SQCONFDIR/config.php"
15 need_restart=0
16
17
18 # Configure poppassd to refuse connection from all hosts
19 # but localhost (127.0.0.1).
20 #
21 if [ ! -f /etc/hosts.deny ]; then
22     touch /etc/hosts.deny
23 fi
24 if ! egrep -q '^poppassd:' /etc/hosts.deny; then
25     echo "poppassd: ALL" | cp-update "$PKG" /etc/hosts.deny
26 fi
27 if [ ! -f /etc/hosts.allow ]; then
28     touch /etc/hosts.allow
29 fi
30 if ! egrep -q '^poppassd:' /etc/hosts.allow; then
31     echo "poppassd: 127.0.0.1" | cp-update "$PKG" /etc/hosts.allow
32 fi
33
34
35 # Enable change_pass plugin in SquirrelMail config.php.
36 #
37 if ! egrep -q '^\$plugins\[[0-9]+\][\ ]*=[\ ]*'\''change_pass'\' "$SQCONF"; then
38     /usr/sbin/squirrelmail-configure --install-plugin change_pass
39 fi
40
41
42 # Convert poppassd service from inetd.conf to xinetd.conf type.
43 # Service configuration is saved in /etc/xinetd.d/ directory.
44 #
45 if [ -x /etc/init.d/xinetd -a -d /etc/xinetd.d -a -x /usr/sbin/itox ]; then
46
47     if egrep -q '^poppassd' /etc/inetd.conf && \
48         [ ! -f /etc/xinetd.d/poppassd ]; then
49
50         cp_echo "CN: Enabling poppassd in /etc/xinetd.d/poppassd"
51
52         touch /etc/xinetd.d/poppassd.$$
53         grep "^poppassd" /etc/inetd.conf  | \
54             itox -daemon_dir /usr/sbin | cp-update "$PKG" /etc/xinetd.d/poppassd.$$
55         cp_mv /etc/xinetd.d/poppassd.$$ /etc/xinetd.d/poppassd
56
57         need_restart=1
58     fi
59 fi
60
61
62 # Restart xinetd if needed.
63 #
64 if [ $need_restart -eq 1 ]; then
65
66     if [ -x "/etc/init.d/xinetd" ]; then
67         if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
68             invoke-rc.d xinetd restart || exit $?
69         else
70             /etc/init.d/xinetd restart || exit $?
71         fi
72     fi
73 fi
74
75
76 # Mail root
77 #
78 cp_mail "$PKG"
79
80 #DEBHELPER#
81
82 exit 0