dns: bashism. Add check for iptables.
authorng0 <ng0@n0.is>
Sat, 9 Mar 2019 10:34:22 +0000 (10:34 +0000)
committerng0 <ng0@n0.is>
Sat, 9 Mar 2019 10:34:22 +0000 (10:34 +0000)
src/dns/test_gnunet_dns.sh

index 57b9716f5b1b4caf676f0a051548a9bdd1fd3893..0fa338c9ba1e930cd5355dceb1ac3ece25a3398b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ME=`whoami`
 if [ "$ME" != "root" ]
@@ -26,12 +26,17 @@ then
   echo "This test requires nslookup.  Skipping."
   exit 77
 fi
-if ! iptables -t mangle --list &> /dev/null
+if [ ! -x `which iptables` ]
+then
+    echo "This test requires iptables.  Skipping."
+    exit 77
+fi
+if ! iptables -t mangle --list > /dev/null 2>&1
 then
   echo "This test requires iptables with 'mangle' support. Skipping."
   exit 77
 fi
-if grep % /etc/resolv.conf &> /dev/null
+if grep % /etc/resolv.conf > /dev/null 2>&1
 then
   echo "This system seems to use a DNS server on an IPv6 link-local address, which is not supported. Skipping."
   exit 77
@@ -52,5 +57,6 @@ else
  echo "Test run, with success."
  ret=0
 fi
+# TODO: jobs is a possible bashism. Fix.
 kill `jobs -p`
 exit $ret