# HG changeset patch # User Pascal Bellard # Date 1270740153 -7200 # Node ID 7534e9548281839e4affef57c82d5a03ab22010e # Parent c028db9bb88208bd15cea9dc42e4455acd575213 dhcp: add init script diff -r c028db9bb882 -r 7534e9548281 dhcp/receipt --- a/dhcp/receipt Thu Apr 08 17:17:44 2010 +0200 +++ b/dhcp/receipt Thu Apr 08 17:22:33 2010 +0200 @@ -24,9 +24,10 @@ # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/usr/sbin $fs/etc + mkdir -p $fs/usr/sbin $fs/etc/init.d cp $_pkg/etc/dhcpd.conf $fs/etc cp $_pkg/usr/sbin/dhcpd $fs/usr/sbin + cp stuff/dhcpd $fs/etc/init.d # Package all dhcp pkgs for i in $(cd $WOK; ls -d dhcp-*) do diff -r c028db9bb882 -r 7534e9548281 dhcp/stuff/dhcpd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dhcp/stuff/dhcpd Thu Apr 08 17:22:33 2010 +0200 @@ -0,0 +1,55 @@ +#!/bin/sh +# /etc/init.d/dhcpd: Start, stop and restart Dhcp deamon on SliTaz, at boot +# time or with the command line. +# +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf. +# +. /etc/init.d/rc.functions +. /etc/daemons.conf + +NAME=Dhcpd +DESC="dhcp deamon" +DAEMON=/usr/sbin/dhcpd +OPTIONS=$DHCPD_OPTIONS +PIDFILE=/var/run/dhcpd.pid + +case "$1" in + start) + if active_pidfile $PIDFILE dhcpd ; then + echo "$NAME already running." + exit 1 + fi + echo -n "Starting $DESC: $NAME... " + $DAEMON $OPTIONS + status + ;; + stop) + if ! active_pidfile $PIDFILE dhcpd ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Stopping $DESC: $NAME... " + kill `cat $PIDFILE` + status + ;; + restart) + if ! active_pidfile $PIDFILE dhcpd ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Restarting $DESC: $NAME... " + kill `cat $PIDFILE` + sleep 2 + $DAEMON $OPTIONS + status + ;; + *) + echo "" + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" + echo "" + exit 1 + ;; +esac + +exit 0 diff -r c028db9bb882 -r 7534e9548281 dhcp6/receipt --- a/dhcp6/receipt Thu Apr 08 17:17:44 2010 +0200 +++ b/dhcp6/receipt Thu Apr 08 17:22:33 2010 +0200 @@ -31,9 +31,10 @@ # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/usr/sbin $fs/etc + mkdir -p $fs/usr/sbin $fs/etc/init.d cp $_pkg/etc/dhcpd.conf $fs/etc cp $_pkg/usr/sbin/dhcpd $fs/usr/sbin + cp $WOK/dhcpd/stuff/dhcpd $fs/etc/init.d # Package all dhcp pkgs for i in $(cd $WOK; ls -d dhcp6-*) do