X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fgns%2Ftest_gns_zkey_lookup.sh;h=03118d74147eca7a169fc5b97c9fc1d91b24bd4e;hb=c29a8124f885f28f287e91ce7a0dabcdd6b17d50;hp=36dec131ebc2a3bb93c2b12e579a04bf8e9ad3d6;hpb=37566e067645bf881b170796251a14d8d20202b8;p=oweals%2Fgnunet.git diff --git a/src/gns/test_gns_zkey_lookup.sh b/src/gns/test_gns_zkey_lookup.sh index 36dec131e..03118d741 100755 --- a/src/gns/test_gns_zkey_lookup.sh +++ b/src/gns/test_gns_zkey_lookup.sh @@ -1,15 +1,21 @@ -#!/bin/bash +#!/bin/sh +# This file is in the public domain. trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT -which timeout &> /dev/null && DO_TIMEOUT="timeout 5" +which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" LOCATION=$(which gnunet-config) if [ -z $LOCATION ] then - echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" - exit 1 + LOCATION="gnunet-config" +fi +$LOCATION --version 1> /dev/null +if test $? != 0 +then + echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" + exit 77 fi -rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` +rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` TEST_IP="127.0.0.1" gnunet-arm -s -c test_gns_lookup.conf @@ -18,12 +24,13 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego gnunet-identity -C testego -c test_gns_lookup.conf gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf -RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.${DELEGATED_PKEY}.zkey -t A -c test_gns_lookup.conf` +RES_IP=`$DO_TIMEOUT gnunet-gns --raw -u www.${DELEGATED_PKEY} -t A -c test_gns_lookup.conf` gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf gnunet-arm -e -c test_gns_lookup.conf +rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` -if [ "$RES_IP" == "$TEST_IP" ] +if [ "$RES_IP" = "$TEST_IP" ] then exit 0 else