Package: openvpn
Version: 2.1~rc7-3
Tags: patch
User: [EMAIL PROTECTED]
Usertags: origin-ubuntu intrepid ubuntu-patch

Hi!

Please consider applying attached patch to use LSB compliant functions
in the init script. This makes the init script work correctly with
things like usplash, splashy, boot loggers, etc.

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
diff -u openvpn-2.1~rc7/debian/openvpn.init.d 
openvpn-2.1~rc7/debian/openvpn.init.d
--- openvpn-2.1~rc7/debian/openvpn.init.d
+++ openvpn-2.1~rc7/debian/openvpn.init.d
@@ -14,6 +14,8 @@
 # Modified for openvpn by Alberto Gonzalez Iniesta <[EMAIL PROTECTED]>
 # Modified for restarting / starting / stopping single tunnels by Richard 
Mueller <[EMAIL PROTECTED]>
 
+. /lib/lsb/init-functions
+
 test $DEBIAN_SCRIPT_DEBUG && set -v -x
 
 DAEMON=/usr/sbin/openvpn
@@ -49,18 +51,18 @@
       STATUSARG="--status /var/run/openvpn.$NAME.status $STATUSREFRESH"
     fi
 
-    echo -n " $NAME"
-    STATUS="OK"
+    log_progress_msg " $NAME"
+    STATUS=0
 
     # Check to see if it's already started...
     if test -e /var/run/openvpn.$NAME.pid ; then
-      STATUS="FAILED - Already running (PID file exists)"
+      log_failure_msg "Already running (PID file exists)"
+      STATUS=1
     else
       $DAEMON --writepid /var/run/openvpn.$NAME.pid \
              $DAEMONARG $STATUSARG --cd $CONFIG_DIR \
-             --config $CONFIG_DIR/$NAME.conf || STATUS="FAILED"
+             --config $CONFIG_DIR/$NAME.conf || STATUS=1
     fi
-    echo -n "($STATUS)"
 }
 stop_vpn () {
   kill `cat $PIDFILE` || true
@@ -70,13 +72,13 @@
 
 case "$1" in
 start)
-  echo -n "Starting $DESC:"
+  log_daemon_msg "Starting $DESC."
 
   # autostart VPNs
   if test -z "$2" ; then
     # check if automatic startup is disabled by AUTOSTART=none
     if test "x$AUTOSTART" = "xnone" -o -z "$AUTOSTART" ; then
-      echo " Autostart disabled."
+      log_failure_msg " Autostart disabled."
       exit 0
     fi
     if test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
@@ -91,7 +93,8 @@
         if test -e $CONFIG_DIR/$NAME.conf ; then
           start_vpn
         else
-          echo -n " (failure: No such VPN: $NAME)"
+          log_failure_msg "No such VPN: $NAME"
+          STATUS=1
         fi
       done
     fi
@@ -103,22 +106,23 @@
         NAME=$1
         start_vpn
       else
-        echo -n " (failure: No such VPN: $1)"
+       log_failure_msg " No such VPN: $1"
+       STATUS=1
       fi
     done
   fi
-  echo "."
+  log_end_msg $STATUS
 
   ;;
 stop)
-  echo -n "Stopping $DESC:"
+  log_daemon_msg "Stopping $DESC."
 
   if test -z "$2" ; then
     for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
       NAME=`echo $PIDFILE | cut -c18-`
       NAME=${NAME%%.pid}
       stop_vpn
-      echo -n " $NAME"
+      log_progress_msg " $NAME"
     done
   else
     while shift ; do
@@ -128,17 +132,17 @@
         NAME=`echo $PIDFILE | cut -c18-`
         NAME=${NAME%%.pid}
         stop_vpn
-        echo -n " $NAME"
+        log_progress_msg " $NAME"
       else
-        echo -n " (failure: No such VPN is running: $1)"
+        log_failure_msg " (failure: No such VPN is running: $1)"
       fi
     done
   fi
-  echo "."
+  log_end_msg 0
   ;;
 # We only 'reload' for running VPNs. New ones will only start with 'start' or 
'restart'.
 reload|force-reload)
-  echo -n "Reloading $DESC:"
+ log_daemon_msg "Reloading $DESC."
   for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
     NAME=`echo $PIDFILE | cut -c18-`
     NAME=${NAME%%.pid}
@@ -147,13 +151,13 @@
       stop_vpn
       sleep 1
       start_vpn
-      echo -n "(restarted)"
+      log_progress_msg "(restarted)"
     else
       kill -HUP `cat $PIDFILE` || true
-    echo -n " $NAME"
+    log_progress_msg " $NAME"
     fi
   done
-  echo "."
+  log_end_msg 0
   ;;
 
 restart)
@@ -163,7 +167,7 @@
   $0 start [EMAIL PROTECTED]
   ;;
 cond-restart)
-  echo -n "Restarting $DESC:"
+  log_daemon_msg "Restarting $DESC."
   for PIDFILE in `ls /var/run/openvpn.*.pid 2> /dev/null`; do
     NAME=`echo $PIDFILE | cut -c18-`
     NAME=${NAME%%.pid}
@@ -171,7 +175,7 @@
     sleep 1
     start_vpn
   done
-  echo "."
+  log_end_msg 0
   ;;
 *)
   echo "Usage: $0 {start|stop|reload|restart|force-reload|cond-restart}" >&2

Attachment: signature.asc
Description: Digital signature

Reply via email to