r5:
[vsftpd-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 # Load CARNet functions
9 . /usr/share/carnet-tools/functions.sh
10
11 if dpkg --compare-versions "$2" lt 2.0.3-1; then
12
13   cp_check_and_sed '^#anonymous_enable=YES' \
14                    's/^#anonymous_enable=YES/anonymous_enable=NO/g' \
15                    /etc/vsftpd.conf && restart="yes" || true
16
17   cp_check_and_sed '^anonymous_enable=YES' \
18                    's/^anonymous_enable=YES/anonymous_enable=NO/g' \
19                    /etc/vsftpd.conf && restart="yes" || true
20
21   cp_check_and_sed '#local_enable=YES' \
22                    's/#local_enable=YES/local_enable=YES/g' \
23                    /etc/vsftpd.conf && restart="yes" || true
24
25   cp_check_and_sed '#write_enable=YES' \
26                    's/#write_enable=YES/write_enable=YES/g' \
27                    /etc/vsftpd.conf && restart="yes" || true
28
29   cp_check_and_sed '^#local_umask=' \
30                    's/#local_umask=.*$/local_umask=022/g' \
31                    /etc/vsftpd.conf && restart="yes" || true
32 fi
33
34 # restart if needed
35 [ "$restart" = "yes" ] || exit 0
36 if [ -x /usr/sbin/invoke-rc.d ]; then
37   invoke-rc.d vsftpd restart
38 else
39   [ -x /etc/init.d/vsftpd ] && /etc/init.d/vsftpd restart
40 fi