summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/check-free-retiolum-v4
diff options
context:
space:
mode:
Diffstat (limited to 'retiolum/bin/check-free-retiolum-v4')
-rwxr-xr-xretiolum/bin/check-free-retiolum-v421
1 files changed, 21 insertions, 0 deletions
diff --git a/retiolum/bin/check-free-retiolum-v4 b/retiolum/bin/check-free-retiolum-v4
new file mode 100755
index 00000000..3f0dbdf8
--- /dev/null
+++ b/retiolum/bin/check-free-retiolum-v4
@@ -0,0 +1,21 @@
+#! /bin/sh
+netname=retiolum
+myipv4=${1-10.7.7.-1}
+v4num=${myipv4##*.}
+printf "Retard check: "
+if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ];
+then
+ printf "No retard detected\n"
+ cd /etc/tinc/$netname/hosts
+ printf "Check if ip is still free: "
+ for i in `ls -1`; do
+ if grep -q -e $myipv4\$ $i ;then
+ echo "Host IP already taken by $i! "
+ exit 1
+ fi
+ done
+ printf "Passed\n"
+else
+ printf "you are made of stupid. bailing out\n"
+ exit 1
+fi