aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-07-20 18:18:46 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-07-20 18:18:46 +0300
commit62317f5a58ffb2161d4fe67aa83a64a4cf738eff (patch)
tree0464523542eee232bbaff01f688631fd34e9d103
parent87a7e7b99daeca3108d873118b4446556162a24a (diff)
downloadarching-kaos-tools-62317f5a58ffb2161d4fe67aa83a64a4cf738eff.tar.gz
arching-kaos-tools-62317f5a58ffb2161d4fe67aa83a64a4cf738eff.tar.bz2
arching-kaos-tools-62317f5a58ffb2161d4fe67aa83a64a4cf738eff.zip
ak cjdns --ip : returns your cjdns ip
-rwxr-xr-xbin/ak-cjdns3
-rwxr-xr-xlib/_ak_cjdns13
2 files changed, 16 insertions, 0 deletions
diff --git a/bin/ak-cjdns b/bin/ak-cjdns
index e7342ac..cff1589 100755
--- a/bin/ak-cjdns
+++ b/bin/ak-cjdns
@@ -12,6 +12,8 @@
##
## --connect Connect to ak cjdns nodes
##
+## --ip Returns your cjdns IPv6
+##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="cjdns helper"
@@ -29,6 +31,7 @@ then
--check) _ak_cjdns_check_availability; exit;;
--install) _ak_cjdns_install; exit;;
--connect) _ak_cjdns_connect_peers; exit;;
+ --ip) _ak_cjdns_get_ip; exit;;
* ) _ak_usage;;
esac
else _ak_usage
diff --git a/lib/_ak_cjdns b/lib/_ak_cjdns
index 0eda944..4328c65 100755
--- a/lib/_ak_cjdns
+++ b/lib/_ak_cjdns
@@ -168,3 +168,16 @@ _ak_cjdns_connect_peers(){
_ak_cjdns_read_peers_to_vars_natively
fi
}
+
+_ak_cjdns_get_ip(){
+ which ip > /dev/null 2>&1
+ if [ $? -ne 0 ]
+ then
+ _ak_log_error "You need ip tool installed"
+ exit 2
+ fi
+ ip a | \
+ grep 'inet6 *fc' | \
+ awk '{print $2}' | \
+ cut -d'/' -f1
+}