wok-current rev 5234
dhcp: add init script
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Apr 08 17:22:33 2010 +0200 (2010-04-08) |
parents | c028db9bb882 |
children | 2be1a2b6a241 |
files | dhcp/receipt dhcp/stuff/dhcpd dhcp6/receipt |
line diff
1.1 --- a/dhcp/receipt Thu Apr 08 17:17:44 2010 +0200 1.2 +++ b/dhcp/receipt Thu Apr 08 17:22:33 2010 +0200 1.3 @@ -24,9 +24,10 @@ 1.4 # Rules to gen a SliTaz package suitable for Tazpkg. 1.5 genpkg_rules() 1.6 { 1.7 - mkdir -p $fs/usr/sbin $fs/etc 1.8 + mkdir -p $fs/usr/sbin $fs/etc/init.d 1.9 cp $_pkg/etc/dhcpd.conf $fs/etc 1.10 cp $_pkg/usr/sbin/dhcpd $fs/usr/sbin 1.11 + cp stuff/dhcpd $fs/etc/init.d 1.12 # Package all dhcp pkgs 1.13 for i in $(cd $WOK; ls -d dhcp-*) 1.14 do
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/dhcp/stuff/dhcpd Thu Apr 08 17:22:33 2010 +0200 2.3 @@ -0,0 +1,55 @@ 2.4 +#!/bin/sh 2.5 +# /etc/init.d/dhcpd: Start, stop and restart Dhcp deamon on SliTaz, at boot 2.6 +# time or with the command line. 2.7 +# 2.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS 2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf. 2.10 +# 2.11 +. /etc/init.d/rc.functions 2.12 +. /etc/daemons.conf 2.13 + 2.14 +NAME=Dhcpd 2.15 +DESC="dhcp deamon" 2.16 +DAEMON=/usr/sbin/dhcpd 2.17 +OPTIONS=$DHCPD_OPTIONS 2.18 +PIDFILE=/var/run/dhcpd.pid 2.19 + 2.20 +case "$1" in 2.21 + start) 2.22 + if active_pidfile $PIDFILE dhcpd ; then 2.23 + echo "$NAME already running." 2.24 + exit 1 2.25 + fi 2.26 + echo -n "Starting $DESC: $NAME... " 2.27 + $DAEMON $OPTIONS 2.28 + status 2.29 + ;; 2.30 + stop) 2.31 + if ! active_pidfile $PIDFILE dhcpd ; then 2.32 + echo "$NAME is not running." 2.33 + exit 1 2.34 + fi 2.35 + echo -n "Stopping $DESC: $NAME... " 2.36 + kill `cat $PIDFILE` 2.37 + status 2.38 + ;; 2.39 + restart) 2.40 + if ! active_pidfile $PIDFILE dhcpd ; then 2.41 + echo "$NAME is not running." 2.42 + exit 1 2.43 + fi 2.44 + echo -n "Restarting $DESC: $NAME... " 2.45 + kill `cat $PIDFILE` 2.46 + sleep 2 2.47 + $DAEMON $OPTIONS 2.48 + status 2.49 + ;; 2.50 + *) 2.51 + echo "" 2.52 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 2.53 + echo "" 2.54 + exit 1 2.55 + ;; 2.56 +esac 2.57 + 2.58 +exit 0
3.1 --- a/dhcp6/receipt Thu Apr 08 17:17:44 2010 +0200 3.2 +++ b/dhcp6/receipt Thu Apr 08 17:22:33 2010 +0200 3.3 @@ -31,9 +31,10 @@ 3.4 # Rules to gen a SliTaz package suitable for Tazpkg. 3.5 genpkg_rules() 3.6 { 3.7 - mkdir -p $fs/usr/sbin $fs/etc 3.8 + mkdir -p $fs/usr/sbin $fs/etc/init.d 3.9 cp $_pkg/etc/dhcpd.conf $fs/etc 3.10 cp $_pkg/usr/sbin/dhcpd $fs/usr/sbin 3.11 + cp $WOK/dhcpd/stuff/dhcpd $fs/etc/init.d 3.12 # Package all dhcp pkgs 3.13 for i in $(cd $WOK; ls -d dhcp6-*) 3.14 do