summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]retiolum/Makefile1
-rwxr-xr-xretiolum/bin/apply-custom-hosts-patches8
-rwxr-xr-x[-rw-r--r--]retiolum/scripts/adv_graphgen/find_super29
3 files changed, 27 insertions, 11 deletions
diff --git a/retiolum/Makefile b/retiolum/Makefile
index a8ae0973..f3424dea 100644..100755
--- a/retiolum/Makefile
+++ b/retiolum/Makefile
@@ -29,3 +29,4 @@ startup:
hosts:
bin/update-retiolum-hosts || :;
+ sudo bin/apply-custom-hosts-patches
diff --git a/retiolum/bin/apply-custom-hosts-patches b/retiolum/bin/apply-custom-hosts-patches
new file mode 100755
index 00000000..2b2fda80
--- /dev/null
+++ b/retiolum/bin/apply-custom-hosts-patches
@@ -0,0 +1,8 @@
+#! /bin/sh
+set -euf
+
+patch=/etc/tinc/retiolum/hosts.patch
+
+if test -e $patch; then
+ patch -N -d /etc/tinc/retiolum/hosts -r - < $patch
+fi
diff --git a/retiolum/scripts/adv_graphgen/find_super b/retiolum/scripts/adv_graphgen/find_super
index c89a94fb..2c316d0e 100644..100755
--- a/retiolum/scripts/adv_graphgen/find_super
+++ b/retiolum/scripts/adv_graphgen/find_super
@@ -1,14 +1,21 @@
-#!/bin/sh
+#! /bin/dash
+set -eu
cd /etc/tinc/retiolum/hosts
-ls -1 . | while read fname;
-do
- for i in `sed -n 's/Address\s*=\s*\(.*\)/\1/p' $fname`;do
- if nc -zw 5 $i 655 2>/dev/null; then
- echo "$fname - $i reachable"
- #else
- #echo -n
- #echo "$fname - $i unreachable"
-
- fi
+for name in `
+ grep '^[[:space:]]*Address[[:space:]]*=' * |
+ cut -d: -f1 | sort | uniq
+`; do
+ if eval "`sed -n '
+ s/[[:space:]]\+//g
+ s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p
+ ' $name`"; then
+ port=${Port-655}
+ for host in $Address; do
+ if nc -zw 2 $host $port 2>/dev/null; then
+ echo "$name [('$host', $port)]"
+ fi &
done
+ wait
+ fi &
done
+wait