]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix RUN_SUDO functionality for t_client.sh
authorGert Doering <gert@greenie.muc.de>
Fri, 3 Feb 2012 17:18:07 +0000 (19:18 +0200)
committerDavid Sommerseth <davids@redhat.com>
Sat, 4 Feb 2012 12:16:06 +0000 (13:16 +0100)
Commit 9c6ee9d1ecd85535c was incomplete - while it will run openvpn with
sudo, it will not use sudo for the "kill" commands needed to test whether
the background process is still there, and for actually stopping openvpn
after the test has finished.

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
t_client.sh.in

index a6377dba05b100d024406d6058838773ff09bb21..47839deef90f08d596f1c170ce8f49394dc8ca90 100755 (executable)
@@ -233,14 +233,14 @@ do
     opid=$!
 
     # make sure openvpn client is terminated in case shell exits
-    trap "kill $opid" 0
-    trap "kill $opid ; trap - 0 ; exit 1" 1 2 3 15
+    trap "$RUN_SUDO kill $opid" 0
+    trap "$RUN_SUDO kill $opid ; trap - 0 ; exit 1" 1 2 3 15
 
     echo "wait for connection to establish..."
     sleep 10
 
     # test whether OpenVPN process is still there
-    if kill -0 $opid
+    if $RUN_SUDO kill -0 $opid
     then :
     else
        echo -e "OpenVPN process has failed to start up, check log ($LOGDIR/$SUF:openvpn.log).  FAIL.\ntail of logfile follows:\n..." >&2
@@ -271,7 +271,7 @@ do
     echo -e "ping tests done.\n"
 
     echo "stopping OpenVPN"
-    kill $opid
+    $RUN_SUDO kill $opid
     wait $!
     rc=$?
     if [ $rc != 0 ] ; then