# HG changeset patch # User Pascal Bellard # Date 1271780601 -7200 # Node ID 1959b2e6b8a04cedfa625347c50a911944937ba1 # Parent 978886b83db3f3b778ae0e5cb0c22780ba0561c9 busybox: update init scripts diff -r 978886b83db3 -r 1959b2e6b8a0 busybox/receipt --- a/busybox/receipt Wed Apr 21 00:04:15 2010 +0000 +++ b/busybox/receipt Tue Apr 20 18:23:21 2010 +0200 @@ -63,10 +63,10 @@ cp stuff/udhcpd.conf $fs/etc touch $fs/etc/resolv.conf cp stuff/inetd.conf $fs/etc - cp stuff/dnsd $fs/etc/init.d - cp stuff/udhcpd $fs/etc/init.d - cp stuff/inetd $fs/etc/init.d - cp stuff/zcip $fs/etc/init.d + cp stuff/daemon $fs/etc/init.d + for i in dnsd inetd udhcpd zcip crond ; do + ln -s daemon $fs/etc/init.d/$i + done cp stuff/init $fs rm $fs/linuxrc mkdir -p $fs/etc/modprobe.d diff -r 978886b83db3 -r 1959b2e6b8a0 busybox/stuff/daemon --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/busybox/stuff/daemon Tue Apr 20 18:23:21 2010 +0200 @@ -0,0 +1,85 @@ +#!/bin/sh +# Start, stop and restart a busybox 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 + +NAME=$(basename $0) +DESC="$NAME deamon" +DAEMON=$(which $NAME) +eval $(grep -i ^${NAME}_OPTIONS /etc/daemons.conf | sed 's/.*_OPT/OPT/') +PIDFILE=/var/run/$NAME.pid + +active_inetd() +{ +if grep $DAEMON /etc/inetd.conf | grep -q ^\#; then + sed -i "s,^#\(.*$DAEMON.*\)$,\1," /etc/inetd.conf + /etc/init.d/inetd stop > /dev/null + exec /etc/init.d/inetd start +else + echo "$NAME is already active." + exit 1 +fi +} + +inactive_inetd() +{ +if grep $DAEMON /etc/inetd.conf | grep -q ^\#; then + echo "$NAME is not active." + exit 1 +else + sed -i "s,^.*$DAEMON.*$,#&," /etc/inetd.conf + /etc/init.d/inetd stop > /dev/null + exec /etc/init.d/inetd start +fi +} + +case "$1" in + start) + grep -qs $DAEMON /etc/inetd.conf && active_inetd + if active_pidfile $PIDFILE $NAME ; then + echo "$NAME is already running." + exit 1 + fi + echo -n "Starting $DESC: $NAME... " + $DAEMON $OPTIONS + [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE + active_pidfile $PIDFILE $NAME + status + ;; + stop) + grep -qs $DAEMON /etc/inetd.conf && inactive_inetd + if ! active_pidfile $PIDFILE $NAME ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Stopping $DESC: $NAME... " + kill `cat $PIDFILE` + status + ;; + restart) + grep -qs $DAEMON /etc/inetd.conf && exit 0 + if ! active_pidfile $PIDFILE $NAME ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Restarting $DESC: $NAME... " + kill `cat $PIDFILE` + sleep 2 + $DAEMON $OPTIONS + [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE + active_pidfile $PIDFILE $NAME + status + ;; +*) + echo "" + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" + echo "" + exit 1 + ;; +esac + +exit 0 diff -r 978886b83db3 -r 1959b2e6b8a0 busybox/stuff/dnsd --- a/busybox/stuff/dnsd Wed Apr 21 00:04:15 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -#!/bin/sh -# /etc/init.d/dnsd: Start, stop and restart DNS 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=Dnsd -DESC="DNS deamon" -DAEMON=/usr/sbin/dnsd -OPTIONS=$DNSD_OPTIONS -PIDFILE=/var/run/dnsd.pid - -case "$1" in - start) - if active_pidfile $PIDFILE dnsd ; then - echo "$NAME already running." - exit 1 - fi - echo -n "Starting $DESC: $NAME... " - $DAEMON $OPTIONS && echo `pidof $DAEMON` > $PIDFILE - status - ;; - stop) - if ! active_pidfile $PIDFILE dnsd ; then - echo "$NAME is not running." - exit 1 - fi - echo -n "Stopping $DESC: $NAME... " - kill `cat $PIDFILE` - rm $PIDFILE - status - ;; - restart) - if ! active_pidfile $PIDFILE dnsd ; then - echo "$NAME is not running." - exit 1 - fi - echo -n "Restarting $DESC: $NAME... " - kill `cat $PIDFILE` - rm $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 978886b83db3 -r 1959b2e6b8a0 busybox/stuff/inetd --- a/busybox/stuff/inetd Wed Apr 21 00:04:15 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -#!/bin/sh -# /etc/init.d/inetd: Start, stop and restart Inet 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=Inetd -DESC="inetd deamon" -DAEMON=/usr/sbin/inetd -OPTIONS=$INETD_OPTIONS -PIDFILE=/var/run/inetd.pid - -case "$1" in - start) - if active_pidfile $PIDFILE inetd ; then - echo "$NAME already running." - exit 1 - fi - echo -n "Starting $DESC: $NAME... " - $DAEMON $OPTIONS - status - ;; - stop) - if ! active_pidfile $PIDFILE inetd ; then - echo "$NAME is not running." - exit 1 - fi - echo -n "Stopping $DESC: $NAME... " - kill `cat $PIDFILE` - status - ;; - restart) - if ! active_pidfile $PIDFILE inetd ; 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 978886b83db3 -r 1959b2e6b8a0 busybox/stuff/udhcpd --- a/busybox/stuff/udhcpd Wed Apr 21 00:04:15 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -#!/bin/sh -# /etc/init.d/udhcpd: Start, stop and restart Udhcp 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=Udhcpd -DESC="udhcp deamon" -DAEMON=/usr/sbin/udhcpd -OPTIONS=$UDHCPD_OPTIONS -PIDFILE=/var/run/udhcpd.pid - -case "$1" in - start) - if active_pidfile $PIDFILE udhcpd ; then - echo "$NAME already running." - exit 1 - fi - echo -n "Starting $DESC: $NAME... " - $DAEMON $OPTIONS - status - pidof udhcpd > $PIDFILE - ;; - stop) - if ! active_pidfile $PIDFILE udhcpd ; then - echo "$NAME is not running." - exit 1 - fi - echo -n "Stopping $DESC: $NAME... " - kill `cat $PIDFILE` - status - ;; - restart) - if ! active_pidfile $PIDFILE udhcpd ; then - echo "$NAME is not running." - exit 1 - fi - echo -n "Restarting $DESC: $NAME... " - kill `cat $PIDFILE` - sleep 2 - $DAEMON $OPTIONS - status - pidof udhcpd > $PIDFILE - ;; - *) - echo "" - echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" - echo "" - exit 1 - ;; -esac - -exit 0 diff -r 978886b83db3 -r 1959b2e6b8a0 busybox/stuff/zcip --- a/busybox/stuff/zcip Wed Apr 21 00:04:15 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -#!/bin/sh -# /etc/init.d/zcip: Start, stop and restart ZeroConf 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 -. /etc/network.conf - -NAME=Zcip -DESC="ZeroConf deamon" -DAEMON=/sbin/zcip -OPTIONS=$ZCIP_OPTIONS -PIDFILE=/var/run/zcip.pid -[ -n "$OPTIONS" ] || OPTIONS="$INTERFACE /etc/zcip.script" - -case "$1" in - start) - if active_pidfile $PIDFILE zcip ; then - echo "$NAME already running." - exit 1 - fi - echo -n "Starting $DESC: $NAME... " - $DAEMON $OPTIONS && echo `pidof $DAEMON` > $PIDFILE - status - ;; - stop) - if ! active_pidfile $PIDFILE zcip ; then - echo "$NAME is not running." - exit 1 - fi - echo -n "Stopping $DESC: $NAME... " - kill `cat $PIDFILE` - rm $PIDFILE - status - ;; - restart) - if ! active_pidfile $PIDFILE zcip ; then - echo "$NAME is not running." - exit 1 - fi - echo -n "Restarting $DESC: $NAME... " - kill `cat $PIDFILE` - rm $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