description="A secure and highly configurable FTP daemon for serving large file archives over a network"
url="ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.6.tar.gz"

contributors="Berlius,Greg,Tnut"
packager="spiky <spiky@nutyx.org>"

makedepends=(libcap pam mariadb openssl pcre postgresql)

name=proftpd
version=1.3.8

runyx_version=20201011

source=(http://downloads.tuxfamily.org/nutyx/files/runyx-${runyx_version}.tar.xz
	ftp://ftp.proftpd.org/distrib/source/$name-$version.tar.gz
	proftpd.conf)

prepare() {
SN="proftpd"
IDN="46"
if ! (getent group $SN > /dev/null); then
   groupadd -g $IDN $SN
fi
if ! (getent passwd $SN > /dev/null); then
   useradd -c "$SN" -d /srv/ftp -g $SN \
   -s /usr/bin/proftpdshell -u  $IDN $SN 
fi
}
build() {
	
 cd $SRC/$name-$version

 ./configure --prefix=/usr \
 --sysconfdir=/etc \
 --localstatedir=/var/run 
 make	

 make DESTDIR=$PKG install

 install -d -m755 $PKG/usr/share/doc/proftpd-$version
 cp -Rv doc/*     $PKG/usr/share/doc/proftpd-$version

 install -d -m755 $PKG/etc 
 cp $SRC/proftpd.conf $PKG/etc/proftpd.conf.example

 ln -sv /bin/false $PKG/usr/bin/proftpdshell

 # Service
 cd $SRC/runyx-${runyx_version}
 make DESTDIR=$PKG install-sysv-proftpd
 make DESTDIR=$PKG install-sysd-proftpd
 make DESTDIR=$PKG install-runyx-proftpd
}
