r1: [svn-inject] Installing original source of vsftpd-cn
[vsftpd-cn.git] / debian / postinst
1 #!/bin/sh
2
3 set -e
4
5 [ "$1" = "configure" ] || exit 0
6
7 # Load CARNet functions
8 . /usr/share/carnet-tools/functions.sh
9
10 if dpkg --compare-versions "$2" lt 2.0.3-1; then
11
12   cp_check_and_sed '^#anonymous_enable=YES' \
13                    's/^#anonymous_enable=YES/anonymous_enable=NO/g' \
14                    /etc/vsftpd.conf && restart="yes" || true
15
16   cp_check_and_sed '^anonymous_enable=YES' \
17                    's/^anonymous_enable=YES/anonymous_enable=NO/g' \
18                    /etc/vsftpd.conf && restart="yes" || true
19
20   cp_check_and_sed '#local_enable=YES' \
21                    's/#local_enable=YES/local_enable=YES/g' \
22                    /etc/vsftpd.conf && restart="yes" || true
23
24   cp_check_and_sed '#write_enable=YES' \
25                    's/#write_enable=YES/write_enable=YES/g' \
26                    /etc/vsftpd.conf && restart="yes" || true
27
28   cp_check_and_sed '^#local_umask=' \
29                    's/#local_umask=.*$/local_umask=022/g' \
30                    /etc/vsftpd.conf && restart="yes" || true
31 fi
32
33 # restart if needed
34 [ "$restart" = "yes" ] || exit 0
35 if [ -x /usr/sbin/invoke-rc.d ]; then
36   invoke-rc.d vsftpd restart
37 else
38   [ -x /etc/init.d/vsftpd ] && /etc/init.d/vsftpd restart
39 fi