# SliTaz package receipt.

PACKED_SIZE="8.0K"
UNPACKED_SIZE="12.0K"
PACKAGE="ftp-config"
VERSION="1.0"
CATEGORY="meta"
GROUP="network"
SHORT_DESC="File transport protocol server configuration"
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="BSD"
WEB_SITE="http://tiny.slitaz.org/"
AUTO_SELECTION="CONFIG_FTPD"
DEPENDS="base-tiny busybox-net"

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/etc
}

config_form()
{
	cat <<EOT
FTP root <input type="text" name="ROOT" ${ROOT:+value="$ROOT" }>
allow upload <input type="checkbox" name="UPLOAD" ${UPLOAD:+checked="checked" }>
EOT
}

post_install()
{
	[ -n "$UPLOAD" ] && ROOT="-w $ROOT"
	grep -q inetd $1/etc/rcS.conf ||
	sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
	sed -i '/#ftp/d' $1/etc/inetd.conf
	grep -q 'stream.*ftpd' $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
ftp	stream	tcp	nowait	root	ftpd ftpd $ROOT
EOT
}
