3 # Configure Proftpd for FusionForge
4 # Christian Bayle, Roland Mas
8 if [ $(id -u) != 0 ] ; then
9 echo "You must be root to run this, please enter passwd"
13 FTPROOT=/var/lib/gforge/chroot/ftproot
14 GRPHOME=/var/lib/gforge/chroot/home/groups
15 FTPCONF=/etc/proftpd/proftpd.conf
19 cp -a ${FTPCONF} ${FTPCONF}.gforge-new
23 if ! grep -q "^Include /etc/gforge/sf-proftpd.conf" ${FTPCONF}.gforge-new ; then
24 perl -pi -e "s/^/#SF#/" ${FTPCONF}.gforge-new
25 echo "### Previous lines commented by GForge install" >> ${FTPCONF}.gforge-new
26 echo "### Next lines inserted by GForge install" >> ${FTPCONF}.gforge-new
27 echo "ServerType standalone" >>${FTPCONF}.gforge-new
28 echo "Include /etc/gforge/sf-proftpd.conf" >> ${FTPCONF}.gforge-new
33 adduser --quiet --system --group --home $FTPROOT sfftp
35 if [ ! -f $FTPROOT/welcome.msg ] ; then
36 cat >$FTPROOT/welcome.msg<<-FIN
37 Welcome, archive user %U@%R !
41 This is an experimental FTP server. If have any unusual problems,
42 please report them via e-mail to <root@%L>.
45 #invoke-rc.d proftpd restart
49 (cd $GRPHOME; ls) | while read group ; do
50 if [ ! -d $FTPROOT/pub/$group ] ; then
51 gid=`ls -lnd $GRPHOME/$group | xargs | cut -d" " -f4`
52 install -o sfftp -g $gid -m 2775 -d $FTPROOT/pub/$group
58 cp -a ${FTPCONF} ${FTPCONF}.gforge-new
59 if grep -q "### Next lines inserted by GForge install" ${FTPCONF}.gforge-new ; then
60 perl -pi -e "s/### Previous lines commented by GForge install\n//" ${FTPCONF}.gforge-new
61 perl -pi -e "s/### Next lines inserted by GForge install\n//" ${FTPCONF}.gforge-new
62 perl -pi -e "s:^Include /etc/gforge/sf-proftpd.conf\n::" ${FTPCONF}.gforge-new
63 perl -pi -e "s:^ServerType standalone\n::" ${FTPCONF}.gforge-new
64 perl -pi -e "s/^#SF#//" ${FTPCONF}.gforge-new
69 #invoke-rc.d proftpd restart
71 deluser --quiet sfftp || true
75 echo "Usage: $0 {configure|configure-files|update|purge|purge-files}"