diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-06-14 18:26:23 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-06-14 18:26:23 +0300 |
commit | 7743751290bb4e7678940be65725a48386e7b986 (patch) | |
tree | a8e1d8fc5c112d36334a649fb862bc207e41d382 | |
parent | 96f7e6ce746231d58a990adcb77d61b0c561082a (diff) | |
download | arching-kaos-tools-7743751290bb4e7678940be65725a48386e7b986.tar.gz arching-kaos-tools-7743751290bb4e7678940be65725a48386e7b986.tar.bz2 arching-kaos-tools-7743751290bb4e7678940be65725a48386e7b986.zip |
Additional checks
-rwxr-xr-x | bin/ak-cjdns-scanner | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/ak-cjdns-scanner b/bin/ak-cjdns-scanner index 8e3cd9d..044670b 100755 --- a/bin/ak-cjdns-scanner +++ b/bin/ak-cjdns-scanner @@ -11,6 +11,13 @@ then exit 1 fi +which publictoip6 > /dev/null 2>&1 +if [ $? -ne 0 ] +then + echo "You need to install cjdns and cjdns-tools" + exit 1 +fi + TEMPDIR="$(mktemp -d)" AK_ZPEERSFILE="$HOME/.arching-kaos/peersFile" cd $TEMPDIR @@ -23,11 +30,11 @@ dumpLinks \ | uniq \ | while read -r ip || [ -n "$ip" ] do - node_info="`curl \ + node_info="$(curl \ --connect-timeout 3 \ -A 'akd/0.1.0; https://github.com/arching-kaos' \ - "http://[$(publictoip6 $ip)]:8610/v0/node_info" 2>/dev/null`" - if [ "$?" == "0" ] + "http://[$(publictoip6 $ip)]:8610/v0/node_info" 2>/dev/null | jq -c -M)" + if [ $? -eq 0 ] && [ $(echo -n "$node_info" | wc -c) -gt 0 ] then if [ "$counter" -ne "0" ] then |