wok-tiny diff udhcpd-config/receipt @ rev 80

Add rsync
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 19 23:03:09 2012 +0200 (2012-07-19)
parents
children a6d2ddc65590
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/udhcpd-config/receipt	Thu Jul 19 23:03:09 2012 +0200
     1.3 @@ -0,0 +1,65 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="udhcpd-config"
     1.7 +VERSION="1.0"
     1.8 +CATEGORY="configuration"
     1.9 +SHORT_DESC="DHCP server configuration file"
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +WEB_SITE="http://boot.slitaz.org/"
    1.12 +DEPENDS="base-tiny"
    1.13 +CONFIG_FILES="/etc/udhcpd.conf /etc/rcS.conf"
    1.14 +
    1.15 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.16 +genpkg_rules()
    1.17 +{
    1.18 +	mkdir -p $fs/etc
    1.19 +}
    1.20 +
    1.21 +DHCP_VARS="start end interface max_leases"
    1.22 +DHCP_OPTS="dns subnet timezone router timesrv namesrv logsrv cookiesrv lprsrv \
    1.23 +bootsize domain swapsrv rootpath ipttl mtu broadcast wins ntpsrv tftp"
    1.24 +
    1.25 +post_install()
    1.26 +{
    1.27 +	grep -q udhcpd $1/etc/rcS.conf ||
    1.28 +	sed -i 's/^RUN_DAEMONS="/&udhcpd /' $1/etc/rcS.conf
    1.29 +	sed -i 's/option/opt/' $1/etc/udhcpd.conf
    1.30 +	for i in $DHCP_VARS ; do
    1.31 +		eval VALUE=\$$(echo $i | tr [a-z] [A-Z])
    1.32 +		sed -i -e "s/^#$i/$i/" -e "s#^$i .*#$i $VALUE#" \
    1.33 +			$1/etc/udhcpd.conf
    1.34 +	done
    1.35 +	for i in $DHCP_OPTS ; do
    1.36 +		eval VALUE=\$$(echo $i | tr [a-z] [A-Z])
    1.37 +		sed -i -e "s/^#opt $i/$opt i/" \
    1.38 +			-e "s#^opt $i .*#opt $i $VALUE#" $1/etc/udhcpd.conf
    1.39 +	done
    1.40 +}
    1.41 +
    1.42 +config_form()
    1.43 +{
    1.44 +	if [ -z "$INTERFACE" ]; then
    1.45 +		. $1/etc/network.conf
    1.46 +		ROUTER=$GATEWAY
    1.47 +		DNS="$DNS_SERVER"
    1.48 +		MAX_LEASES=254
    1.49 +		START=$(awk '/^start/ { print $2 }' < $1/etc/udhcpd.conf)
    1.50 +		END=$(awk '/^end/ { print $2 }' < $1/etc/udhcpd.conf)
    1.51 +	fi
    1.52 +	cat <<EOT
    1.53 +<table>
    1.54 +EOT
    1.55 +	for i in $DHCP_VARS $DHCP_OPTS ; do
    1.56 +		VAR=$(echo $i | tr [a-z] [A-Z])
    1.57 +		eval VALUE=\$$VAR
    1.58 +		cat <<EOT
    1.59 +<tr>
    1.60 +<td>$i</td>
    1.61 +<td><input type="text" name="$VAR" value="$VALUE" /></td>
    1.62 +</tr>
    1.63 +EOT
    1.64 +	done
    1.65 +	cat <<EOT
    1.66 +</table>
    1.67 +EOT
    1.68 +}