summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/update_tinc_hosts
diff options
context:
space:
mode:
Diffstat (limited to 'retiolum/bin/update_tinc_hosts')
-rwxr-xr-xretiolum/bin/update_tinc_hosts8
1 files changed, 6 insertions, 2 deletions
diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts
index fe0785e3..b3529a7f 100755
--- a/retiolum/bin/update_tinc_hosts
+++ b/retiolum/bin/update_tinc_hosts
@@ -17,7 +17,7 @@ es='# END OF RETIOLUM'
case "${*-I am made of stupid}" in
(start|restart)
- hosts | $0 replace magic
+ hosts | grep -P "^(10|42)" | $0 replace magic
;;
(stop)
$0 clear magic
@@ -29,9 +29,13 @@ case "${*-I am made of stupid}" in
;;
('create magic')
$0 has magic || $0 print magic >> $hosts < /dev/null
+ $0 start
;;
('destroy magic')
- $0 has magic && sed -ie "/^$bs$/,/^$es$/d" $hosts
+ if $0 has magic; then
+ cache="`cat $hosts`"
+ echo "$cache" | sed "/^$bs$/,/^$es$/d" > $hosts
+ fi
;;
('has magic')
grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts