wok-tiny rev 87

Add lpd-spooling-config
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Aug 21 20:42:47 2012 +0200 (2012-08-21)
parents dc8eca11e97c
children 8cb0d15c82ba
files dropbear-without-zlib/receipt dropbear/receipt lpd-spooling-config/receipt lpd-spooling-config/stuff/lpd-helper
line diff
     1.1 --- a/dropbear-without-zlib/receipt	Tue Aug 21 19:04:10 2012 +0200
     1.2 +++ b/dropbear-without-zlib/receipt	Tue Aug 21 20:42:47 2012 +0200
     1.3 @@ -58,11 +58,13 @@
     1.4  # Post message when installing.
     1.5  post_install()
     1.6  {
     1.7 -	grep -q inetd $1/etc/rcS.conf ||
     1.8 -	sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
     1.9 -	grep -q dropbear $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
    1.10 +	if [ "$STARTDAEMON" = "ON" ]; then
    1.11 +		grep -q inetd $1/etc/rcS.conf ||
    1.12 +		sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
    1.13 +		grep -q dropbear $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
    1.14  ssh	stream	tcp	nowait	root	/usr/sbin/dropbear	/usr/sbin/dropbear -i $DROPBEAR_OPTS
    1.15  EOT
    1.16 +	fi
    1.17  	dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_dss_host_key
    1.18  $DSSKEY
    1.19  EOT
    1.20 @@ -96,6 +98,8 @@
    1.21  	RSAPUB="$(dropbearkey  -y -f /tmp/mkssh$$ | grep ^ssh)"
    1.22  	rm -f /tmp/mkssh$$
    1.23  	cat <<EOT
    1.24 +<input type="checkbox" name="STARTDAEMON" value="ON" checked="checked" />
    1.25 +Start server during boot<br>
    1.26  <table>
    1.27  <tr>
    1.28  <td>Server options</td>
     2.1 --- a/dropbear/receipt	Tue Aug 21 19:04:10 2012 +0200
     2.2 +++ b/dropbear/receipt	Tue Aug 21 20:42:47 2012 +0200
     2.3 @@ -58,11 +58,13 @@
     2.4  # Post message when installing.
     2.5  post_install()
     2.6  {
     2.7 -	grep -q inetd $1/etc/rcS.conf ||
     2.8 -	sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
     2.9 -	grep -q dropbear $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
    2.10 +	if [ "$STARTDAEMON" = "ON" ]; then
    2.11 +		grep -q inetd $1/etc/rcS.conf ||
    2.12 +		sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
    2.13 +		grep -q dropbear $1/etc/inetd.conf || cat >> $1/etc/inetd.conf <<EOT
    2.14  ssh	stream	tcp	nowait	root	/usr/sbin/dropbear	/usr/sbin/dropbear -i $DROPBEAR_OPTS
    2.15  EOT
    2.16 +	fi
    2.17  	dos2unix <<EOT | uudecode - > $1/etc/dropbear/dropbear_dss_host_key
    2.18  $DSSKEY
    2.19  EOT
    2.20 @@ -96,6 +98,8 @@
    2.21  	RSAPUB="$(dropbearkey  -y -f /tmp/mkssh$$ | grep ^ssh)"
    2.22  	rm -f /tmp/mkssh$$
    2.23  	cat <<EOT
    2.24 +<input type="checkbox" name="STARTDAEMON" value="ON" checked="checked" />
    2.25 +Start server during boot<br>
    2.26  <table>
    2.27  <tr>
    2.28  <td>Server options</td>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/lpd-spooling-config/receipt	Tue Aug 21 20:42:47 2012 +0200
     3.3 @@ -0,0 +1,40 @@
     3.4 +# SliTaz package receipt.
     3.5 +
     3.6 +PACKAGE="lpd-spooling-config"
     3.7 +VERSION="1.0"
     3.8 +CATEGORY="configuration"
     3.9 +SHORT_DESC="Line printer server configuration"
    3.10 +MAINTAINER="pascal.bellard@slitaz.org"
    3.11 +WEB_SITE="http://tiny.slitaz.org/"
    3.12 +DEPENDS="base-tiny"
    3.13 +
    3.14 +# Rules to gen a SliTaz package suitable for Tazpkg.
    3.15 +genpkg_rules()
    3.16 +{
    3.17 +	mkdir -p $fs/var/spool $fs/dev $fs/usr/sbin
    3.18 +	cp stuff/lpd-helper $fs/usr/sbin
    3.19 +}
    3.20 +
    3.21 +config_form()
    3.22 +{
    3.23 +	cat <<EOT
    3.24 +Respective printer names for lp0, lp1 ... 
    3.25 +<input type="text" name="LP_NAMES" value="$LP_NAMES" >
    3.26 +EOT
    3.27 +}
    3.28 +
    3.29 +post_install()
    3.30 +{
    3.31 +	local n
    3.32 +	grep -q inetd $1/etc/rcS.conf ||
    3.33 +	sed -i 's/^RUN_DAEMONS="/&inetd /' $1/etc/rcS.conf
    3.34 +	cat >> $1/etc/inetd.conf <<EOT
    3.35 +printer	stream	tcp	nowait	root	/usr/sbin/lpd /usr/sbin/lpd /var/spool /usr/sbin/lpd-helper
    3.36 +EOT
    3.37 +	n=0
    3.38 +	for i in $(echo $LP_NAMES | sed 's/,/ /g') ; do
    3.39 +		mknod $1/dev/lp$n c 6 $n
    3.40 +		mkdir $1/var/spool/$i
    3.41 +		n=$(($n + 1))
    3.42 +	done
    3.43 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/lpd-spooling-config/stuff/lpd-helper	Tue Aug 21 20:42:47 2012 +0200
     4.3 @@ -0,0 +1,9 @@
     4.4 +#!/bin/sh
     4.5 +
     4.6 +n=0
     4.7 +for i in $(ls -tr /var/spool); do
     4.8 +	[ /var/spool/$i == $PWD ] && break
     4.9 +	n=$(($n+1))
    4.10 +done
    4.11 +cat ./"$DATAFILE" >/dev/lp$n
    4.12 +rm -f ./"$DATAFILE"