]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Build t_client.sh by configure at run-time.
authorGert Doering <gert@greenie.muc.de>
Tue, 10 Aug 2010 10:39:28 +0000 (12:39 +0200)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Thu, 21 Oct 2010 09:40:36 +0000 (11:40 +0200)
This is now built using "configure", knows how to find "ip", "ifconfig" and "netstat" (configure
does the work :-) ), *and* has been tested on Solaris (works!).

extend configure.ac to find "netstat" binary and to chmod +x "t_client.sh"

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: David Sommerseth <dazo@users.sourceforge.net>
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
configure.ac
t_client.sh.in [moved from t_client.sh with 92% similarity, mode: 0755]

index c817938f83b1084808408bb375de36579458bf7e..4777108893379df5329477abc79083597806e735 100644 (file)
@@ -266,6 +266,13 @@ AC_ARG_WITH(route-path,
 )
 AC_DEFINE_UNQUOTED(ROUTE_PATH, "$ROUTE", [Path to route tool])
 
+AC_ARG_WITH(netstat-path,
+   [  --with-netstat-path=PATH  Path to netstat tool],
+   [NETSTAT="$withval"],
+   [AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])]
+)
+AC_DEFINE_UNQUOTED(NETSTAT_PATH, "$NETSTAT", [Path to netstat tool])
+
 AC_ARG_WITH(mem-check,
    [  --with-mem-check=TYPE  Build with debug memory checking, TYPE = dmalloc or valgrind],
    [MEMCHECK="$withval"]
@@ -913,6 +920,7 @@ if test -z "${htmldir}"; then
 fi
 # end workaround
 
+AC_CONFIG_FILES([t_client.sh], [chmod +x t_client.sh])
 AC_OUTPUT([
        Makefile
        openvpn.spec
old mode 100644 (file)
new mode 100755 (executable)
similarity index 92%
rename from t_client.sh
rename to t_client.sh.in
index 3a0dadb..664b2fd
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
 #
 # run OpenVPN client against ``test reference'' server
 # - check that ping, http, ... via tunnel works
@@ -79,13 +79,13 @@ fail()
 # this is higly system dependent...
 get_ifconfig_route()
 {
-    # linux / iproute2?
-    if [ -x /sbin/ip -o -x /usr/sbin/ip ]
+    # linux / iproute2? (-> if configure got a path)
+    if [ "@IPROUTE@" != "ip" ]
     then
        echo "-- linux iproute2 --"
-       ip addr show     | grep -v valid_lft
-       ip route show
-       ip -6 route show | sed -e 's/expires [0-9]*sec //'
+       @IPROUTE@ addr show     | grep -v valid_lft
+       @IPROUTE@ route show
+       @IPROUTE@ -6 route show | sed -e 's/expires [0-9]*sec //'
        return
     fi
 
@@ -93,27 +93,27 @@ get_ifconfig_route()
     case `uname -s` in
        Linux)
           echo "-- linux / ifconfig --"
-          LANG=C ifconfig -a |egrep  "( addr:|encap:)"
-          LANG=C netstat -rn -4 -6
+          LANG=C @IFCONFIG@ -a |egrep  "( addr:|encap:)"
+          LANG=C @NETSTAT@ -rn -4 -6
           return
           ;;
        FreeBSD|NetBSD|Darwin)
           echo "-- FreeBSD/NetBSD/Darwin [MacOS X] --"
-          ifconfig -a | egrep "(flags=|inet)"
-          netstat -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }'
+          @IFCONFIG@ -a | egrep "(flags=|inet)"
+          @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }'
           return
           ;;
        OpenBSD)
           echo "-- OpenBSD --"
-          ifconfig -a | egrep "(flags=|inet)" | \
+          @IFCONFIG@ -a | egrep "(flags=|inet)" | \
                sed -e 's/pltime [0-9]*//' -e 's/vltime [0-9]*//'
-          netstat -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }'
+          @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$NF }'
           return
           ;;
        SunOS)
           echo "-- Solaris --"
-          ifconfig -a | egrep "(flags=|inet)"
-          netstat -rn
+          @IFCONFIG@ -a | egrep "(flags=|inet)"
+          @NETSTAT@ -rn | awk '$3 !~ /^UHL/ { print $1,$2,$3,$6 }'
           return
           ;;
     esac