wok diff openvpn/stuff/etc/init.d/openvpn-client @ 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-client	Sun May 18 20:24:07 2014 +0000
     1.2 +++ b/openvpn/stuff/etc/init.d/openvpn-client	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/openvpni-client.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/client.conf ]; then
    1.37 -	echo "Missing OpenVPN client config."
    1.38 +      _ 'Missing OpenVPN client config.'
    1.39      exit 1
    1.40      fi
    1.41      if active_pidfile $PIDFILE openvpn ; then
    1.42 -      echo "$NAME already running."
    1.43 +      _ '%s is already running.' $NAME
    1.44        exit 1
    1.45      fi
    1.46 -    echo -n "Starting $DESC: $NAME... "
    1.47 +    action 'Starting %s: %s...' "$DESC" $NAME
    1.48      $DAEMON --client $OPTIONS
    1.49      status
    1.50      ;;
    1.51    stop)
    1.52      if ! active_pidfile $PIDFILE openvpn ; then
    1.53 -      echo "$NAME is not running."
    1.54 +      _ '%s is not running.' $NAME
    1.55        exit 1
    1.56      fi
    1.57 -    echo -n "Stopping $DESC: $NAME... "
    1.58 -    kill `cat $PIDFILE`
    1.59 +    action 'Stopping %s: %s...' "$DESC" $NAME
    1.60 +    kill $(cat $PIDFILE)
    1.61      rm $PIDFILE
    1.62      status
    1.63      ;;
    1.64    restart)
    1.65      if ! active_pidfile $PIDFILE openvpn ; then
    1.66 -      echo "$NAME is not running."
    1.67 +      _ '%s is not running.' $NAME
    1.68        exit 1
    1.69      fi
    1.70 -    echo -n "Restarting $DESC: $NAME... "
    1.71 -    kill `cat $PIDFILE`
    1.72 +    action 'Restarting %s: %s...' "$DESC" $NAME
    1.73 +    kill $(cat $PIDFILE)
    1.74      rm $PIDFILE
    1.75      sleep 2
    1.76      $DAEMON --client $OPTIONS
    1.77      status
    1.78      ;;
    1.79    *)
    1.80 -    echo ""
    1.81 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.82 -    echo ""
    1.83 +    emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
    1.84 +    newline
    1.85      exit 1
    1.86      ;;
    1.87  esac