wok-next diff openvpn/stuff/etc/init.d/openvpn-server @ 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 0d8a1a3edc72
children ff5fd8788cd9
line diff
     1.1 --- a/openvpn/stuff/etc/init.d/openvpn-server	Sun May 18 20:24:07 2014 +0000
     1.2 +++ b/openvpn/stuff/etc/init.d/openvpn-server	Thu May 26 20:16:45 2016 +0300
     1.3 @@ -9,7 +9,7 @@
     1.4  . /etc/daemons.conf
     1.5  
     1.6  NAME=OpenVPN
     1.7 -DESC="VPN daemon"
     1.8 +DESC="$(_ '%s daemon' VPN)"
     1.9  DAEMON=/usr/sbin/openvpn
    1.10  OPTIONS=$OPENVPN_OPTIONS
    1.11  PIDFILE=/var/run/openvpn-server.pid
    1.12 @@ -17,60 +17,60 @@
    1.13  checktundevice() {
    1.14  	if [ ! -e /dev/net/tun ]; then
    1.15  		if ! modprobe tun ; then
    1.16 -			echo -n "TUN/TAP support is not available in this kernel"
    1.17 +			_ 'TUN/TAP support is not available in this Kernel'
    1.18  			return 1
    1.19  		fi
    1.20  	fi
    1.21 -	if [ -h /dev/net/tun ] && [ -c /dev/misc/net/tun ]; then
    1.22 -		echo -n "Detected broken /dev/net/tun symlink, fixing..."
    1.23 +	if [ -h /dev/net/tun -a -c /dev/misc/net/tun ]; then
    1.24 +		_ 'Detected broken %s symlink, fixing...' '/dev/net/tun'
    1.25  		rm -f /dev/net/tun
    1.26  		ln -s /dev/misc/net/tun /dev/net/tun
    1.27  	fi
    1.28  }
    1.29  
    1.30  [ -d /var/run/openvpn ] || mkdir -p /var/run/openvpn
    1.31 +
    1.32  case "$1" in
    1.33    start)
    1.34      checktundevice
    1.35  
    1.36      if [ ! -e /etc/openvpn/server.conf ]; then
    1.37 -	echo "Missing OpenVPN server config."
    1.38 -	exit 1
    1.39 +      _ 'Missing OpenVPN server config.'
    1.40 +      exit 1
    1.41      fi
    1.42      if active_pidfile $PIDFILE openvpn ; then
    1.43 -      echo "$NAME already running."
    1.44 +      _ '%s is already running.' $NAME
    1.45        exit 1
    1.46      fi
    1.47 -    echo -n "Starting $DESC: $NAME... "
    1.48 +    action 'Starting %s: %s...' "$DESC" $NAME
    1.49      $DAEMON $OPTIONS
    1.50      status
    1.51      ;;
    1.52    stop)
    1.53      if ! active_pidfile $PIDFILE openvpn ; then
    1.54 -      echo "$NAME is not running."
    1.55 +      _ '%s is not running.' $NAME
    1.56        exit 1
    1.57      fi
    1.58 -    echo -n "Stopping $DESC: $NAME... "
    1.59 -    kill `cat $PIDFILE`
    1.60 +    action 'Stopping %s: %s...' "$DESC" $NAME
    1.61 +    kill $(cat $PIDFILE)
    1.62      rm $PIDFILE
    1.63      status
    1.64      ;;
    1.65    restart)
    1.66      if ! active_pidfile $PIDFILE openvpn ; then
    1.67 -      echo "$NAME is not running."
    1.68 +      _ '%s is not running.' $NAME
    1.69        exit 1
    1.70      fi
    1.71 -    echo -n "Restarting $DESC: $NAME... "
    1.72 -    kill `cat $PIDFILE`
    1.73 +    action 'Restarting %s: %s...' "$DESC" $NAME
    1.74 +    kill $(cat $PIDFILE)
    1.75      rm $PIDFILE
    1.76      sleep 2
    1.77      $DAEMON $OPTIONS
    1.78      status
    1.79      ;;
    1.80    *)
    1.81 -    echo ""
    1.82 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.83 -    echo ""
    1.84 +    emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
    1.85 +    newline
    1.86      exit 1
    1.87      ;;
    1.88  esac