wok diff dropbear/stuff/init.d/dropbear @ 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 0c5bcb5a0cad
children ce7157786dac
line diff
     1.1 --- a/dropbear/stuff/init.d/dropbear	Tue Mar 10 09:13:49 2009 +0000
     1.2 +++ b/dropbear/stuff/init.d/dropbear	Thu May 26 20:16:45 2016 +0300
     1.3 @@ -1,5 +1,5 @@
     1.4  #!/bin/sh
     1.5 -# /etc/init.d/dropbear : Start, stop and restart SSH server on SliTaz, at 
     1.6 +# /etc/init.d/dropbear : Start, stop and restart SSH server on SliTaz, at
     1.7  # boot time or with the command line.
     1.8  #
     1.9  # To start SSH server at boot time, just put dropbear in the $RUN_DAEMONS
    1.10 @@ -9,7 +9,7 @@
    1.11  . /etc/daemons.conf
    1.12  
    1.13  NAME=Dropbear
    1.14 -DESC="SSH server"
    1.15 +DESC="$(_ '%s server' SSH)"
    1.16  DAEMON=/usr/sbin/dropbear
    1.17  OPTIONS=$DROPBEAR_OPTIONS
    1.18  PIDFILE=/var/run/dropbear.pid
    1.19 @@ -18,51 +18,50 @@
    1.20    start)
    1.21      # We need rsa and dss host key file to start dropbear.
    1.22      if [ ! -s /etc/dropbear/dropbear_rsa_host_key ] ; then
    1.23 -      echo -n "Generating $NAME rsa key... "
    1.24 +      action 'Generating Dropbear %s key...' RSA
    1.25        # Need to delete key before creating it.
    1.26        rm -f /etc/dropbear/dropbear_rsa_host_key
    1.27 -      dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key > /dev/null 2>&1
    1.28 +      dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key >/dev/null 2>&1
    1.29        status
    1.30      fi
    1.31      if [ ! -s /etc/dropbear/dropbear_dss_host_key ] ; then
    1.32 -      echo -n "Generating $NAME dss key... "
    1.33 +      action 'Generating Dropbear %s key...' DSS
    1.34        # Need to delete key before creating it.
    1.35        rm -f /etc/dropbear/dropbear_dss_host_key
    1.36 -      dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key > /dev/null 2>&1
    1.37 +      dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key >/dev/null 2>&1
    1.38        status
    1.39      fi
    1.40      if active_pidfile $PIDFILE dropbear ; then
    1.41 -      echo "$NAME already running."
    1.42 +      _ '%s is already running.' $NAME
    1.43        exit 1
    1.44      fi
    1.45 -    echo -n "Starting $DESC: $NAME... "
    1.46 +    action 'Starting %s: %s...' "$DESC" $NAME
    1.47      $DAEMON $OPTIONS
    1.48      status
    1.49      ;;
    1.50    stop)
    1.51      if ! active_pidfile $PIDFILE dropbear ; then
    1.52 -      echo "$NAME is not running."
    1.53 +      _ '%s is not running.' $NAME
    1.54        exit 1
    1.55      fi
    1.56 -    echo -n "Stopping $DESC: $NAME... "
    1.57 -    kill `cat $PIDFILE`
    1.58 +    action 'Stopping %s: %s...' "$DESC" $NAME
    1.59 +    kill $(cat $PIDFILE)
    1.60      status
    1.61      ;;
    1.62    restart)
    1.63      if ! active_pidfile $PIDFILE dropbear ; then
    1.64 -      echo "$NAME is not running."
    1.65 +      _ '%s is not running.' $NAME
    1.66        exit 1
    1.67      fi
    1.68 -    echo -n "Restarting $DESC: $NAME... "
    1.69 -    kill `cat $PIDFILE`
    1.70 +    action 'Restarting %s: %s...' "$DESC" $NAME
    1.71 +    kill $(cat $PIDFILE)
    1.72      sleep 2
    1.73      $DAEMON $OPTIONS
    1.74      status
    1.75      ;;
    1.76    *)
    1.77 -    echo ""
    1.78 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.79 -    echo ""
    1.80 +    emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
    1.81 +    newline
    1.82      exit 1
    1.83      ;;
    1.84  esac