# SliTaz package receipt.

PACKED_SIZE="8.0K"
UNPACKED_SIZE="16.0K"
PACKAGE="lpd-config"
VERSION="1.0"
CATEGORY="meta"
SHORT_DESC="Line printer server configuration (without spooling)"
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="BSD"
WEB_SITE="http://tiny.slitaz.org/"
AUTO_SELECTION="CONFIG_LPD"
DEPENDS="base-tiny busybox-net"
SUGGESTED="module-lp module-usblp"

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

config_form()
{
	cat <<EOT
Respective printer names for lp0, lp1 ... 
<input type="text" name="LP_NAMES" value="${LP_NAMES:-printer}" >
EOT
}

post_install()
{
	local n
	grep -q inetd $1/etc/rcS.conf ||
	sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
	cat >> $1/etc/inetd.conf <<EOT
printer	stream	tcp	nowait	root	lpd lpd /var/spool
EOT
	n=0
	for i in $(echo $LP_NAMES | sed 's/,/ /g') ; do
		mknod $1/dev/lp$n c 6 $n
		ln -s /dev/lp$n $1/var/spool/$i
		n=$(($n + 1))
	done
}
