From bd44e393c7fcc5d2f92a99a2d6b52f1815ebdb84 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Sep 2011 16:44:11 +0200 Subject: //retiolum/bin/update_tinc_hosts: sed -i is evil, too --- retiolum/bin/update_tinc_hosts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'retiolum/bin/update_tinc_hosts') diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts index fe0785e3..8cdc3beb 100755 --- a/retiolum/bin/update_tinc_hosts +++ b/retiolum/bin/update_tinc_hosts @@ -31,7 +31,10 @@ case "${*-I am made of stupid}" in $0 has magic || $0 print magic >> $hosts < /dev/null ;; ('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 -- cgit v1.2.3 From 1bc1b54e445f2d48d8f4c2080240a0f4e94d0c96 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Sep 2011 16:45:54 +0200 Subject: //retiolum/bin/update_tinc_hosts: create magic implies [re]start --- retiolum/bin/update_tinc_hosts | 1 + 1 file changed, 1 insertion(+) (limited to 'retiolum/bin/update_tinc_hosts') diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts index 8cdc3beb..86a28992 100755 --- a/retiolum/bin/update_tinc_hosts +++ b/retiolum/bin/update_tinc_hosts @@ -29,6 +29,7 @@ case "${*-I am made of stupid}" in ;; ('create magic') $0 has magic || $0 print magic >> $hosts < /dev/null + $0 start ;; ('destroy magic') if $0 has magic; then -- cgit v1.2.3