wok diff busybox/stuff/daemon @ rev 19159

/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 26 20:16:45 2016 +0300 (2016-05-26)
parents d2c1950b6f95
children ff5fd8788cd9
line diff
     1.1 --- a/busybox/stuff/daemon	Fri Nov 13 10:54:50 2015 +0100
     1.2 +++ b/busybox/stuff/daemon	Thu May 26 20:16:45 2016 +0300
     1.3 @@ -1,5 +1,5 @@
     1.4  #!/bin/sh
     1.5 -# Start, stop and restart a busybox deamon on SliTaz, at boot time or 
     1.6 +# Start, stop and restart a busybox deamon on SliTaz, at boot time or
     1.7  # with the command line.
     1.8  #
     1.9  # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
    1.10 @@ -8,12 +8,13 @@
    1.11  . /etc/init.d/rc.functions
    1.12  
    1.13  NAME=$(basename $0)
    1.14 -DESC="$NAME deamon"
    1.15 +DESC="$(_ '%s daemon' $NAME)"
    1.16  DAEMON=$(which $NAME)
    1.17  for p in ${PATH//:/ }; do
    1.18  	[ -L $p/$NAME ] || continue
    1.19  	case "$(readlink $p/$NAME)" in
    1.20 -	*busybox)	DAEMON=$p/$NAME
    1.21 +		*busybox)
    1.22 +			DAEMON=$p/$NAME
    1.23  			break
    1.24  	esac
    1.25  done
    1.26 @@ -24,10 +25,10 @@
    1.27  {
    1.28  if grep $DAEMON /etc/inetd.conf | grep -q ^\#; then
    1.29      sed -i "s,^#\(.*$DAEMON.*\)$,\1," /etc/inetd.conf
    1.30 -    /etc/init.d/inetd stop > /dev/null
    1.31 +    /etc/init.d/inetd stop >/dev/null
    1.32      exec /etc/init.d/inetd start
    1.33  else
    1.34 -    echo "$NAME is already active."
    1.35 +    _ '%s is already active.' $NAME
    1.36      exit 1
    1.37  fi
    1.38  }
    1.39 @@ -35,11 +36,11 @@
    1.40  inactive_inetd()
    1.41  {
    1.42  if grep $DAEMON /etc/inetd.conf | grep -q ^\#; then
    1.43 -    echo "$NAME is not active."
    1.44 +    _ '%s is not active.' $NAME
    1.45      exit 1
    1.46  else
    1.47      sed -i "s,^.*$DAEMON.*$,#&," /etc/inetd.conf
    1.48 -    /etc/init.d/inetd stop > /dev/null
    1.49 +    /etc/init.d/inetd stop >/dev/null
    1.50      exec /etc/init.d/inetd start
    1.51  fi
    1.52  }
    1.53 @@ -48,43 +49,42 @@
    1.54    start)
    1.55      grep -qs $DAEMON /etc/inetd.conf && active_inetd
    1.56      if active_pidfile $PIDFILE $NAME ; then
    1.57 -      echo "$NAME is already running."
    1.58 +      _ '%s is already running.' $NAME
    1.59        exit 1
    1.60      fi
    1.61 -    echo -n "Starting $DESC: $NAME... "
    1.62 -    $DAEMON $OPTIONS 
    1.63 -    [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
    1.64 +    action 'Starting %s: %s...' "$DESC" $NAME
    1.65 +    $DAEMON $OPTIONS
    1.66 +    [ -f $PIDFILE ] || pidof $NAME | awk '{print $1}' > $PIDFILE
    1.67      active_pidfile $PIDFILE $NAME
    1.68      status
    1.69      ;;
    1.70    stop)
    1.71      grep -qs $DAEMON /etc/inetd.conf && inactive_inetd
    1.72      if ! active_pidfile $PIDFILE $NAME ; then
    1.73 -      echo "$NAME is not running."
    1.74 +      _ '%s is not running.' $NAME
    1.75        exit 1
    1.76      fi
    1.77 -    echo -n "Stopping $DESC: $NAME... "
    1.78 -    kill `cat $PIDFILE`
    1.79 +    action 'Stopping %s: %s...' "$DESC" $NAME
    1.80 +    kill $(cat $PIDFILE)
    1.81      status
    1.82      ;;
    1.83    restart)
    1.84      grep -qs $DAEMON /etc/inetd.conf && exit 0
    1.85      if ! active_pidfile $PIDFILE $NAME ; then
    1.86 -      echo "$NAME is not running."
    1.87 +      _ '%s is not running.' $NAME
    1.88        exit 1
    1.89      fi
    1.90 -    echo -n "Restarting $DESC: $NAME... "
    1.91 -    kill `cat $PIDFILE`
    1.92 +    action 'Restarting %s: %s...' "$DESC" $NAME
    1.93 +    kill $(cat $PIDFILE)
    1.94      sleep 2
    1.95      $DAEMON $OPTIONS
    1.96 -    [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE
    1.97 +    [ -f $PIDFILE ] || pidof $NAME | awk '{print $1}' > $PIDFILE
    1.98      active_pidfile $PIDFILE $NAME
    1.99      status
   1.100      ;;
   1.101 -*)
   1.102 -    echo ""
   1.103 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
   1.104 -    echo ""
   1.105 +  *)
   1.106 +    emsg "<n><b>$(_ 'Usage:')</b> /etc/init.d/$(basename $0) [start|stop|restart]"
   1.107 +    newline
   1.108      exit 1
   1.109      ;;
   1.110  esac