summaryrefslogtreecommitdiffstats
path: root/retiolum/bin
diff options
context:
space:
mode:
Diffstat (limited to 'retiolum/bin')
-rwxr-xr-xretiolum/bin/update_tinc_hosts5
1 files changed, 4 insertions, 1 deletions
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