summaryrefslogtreecommitdiffstats
path: root/retiolum/bin
diff options
context:
space:
mode:
authortv <tv@iiso>2011-10-12 13:05:07 +0200
committertv <tv@iiso>2011-10-12 13:05:07 +0200
commit979a90b5e238d3bdfea16599d93128cfd1475bc4 (patch)
tree4ba55e281f05607943303257ec32b125d0ddfbf8 /retiolum/bin
parent8b1827f42d3d8a967b9a385bbb048835e1792872 (diff)
//retiolum supernode-...: add little doc
Diffstat (limited to 'retiolum/bin')
-rwxr-xr-xretiolum/bin/supernode-update-hosts-and-hup30
1 files changed, 18 insertions, 12 deletions
diff --git a/retiolum/bin/supernode-update-hosts-and-hup b/retiolum/bin/supernode-update-hosts-and-hup
index 221a7538..bfba6409 100755
--- a/retiolum/bin/supernode-update-hosts-and-hup
+++ b/retiolum/bin/supernode-update-hosts-and-hup
@@ -1,4 +1,8 @@
#! /bin/sh
+#
+# @oxberg we do put this into crontab:
+# * * * * * /supernode-update-hosts-and-hup
+#
set -euf
cd /etc/tinc/retiolum/hosts
@@ -13,25 +17,27 @@ _hrefs() {
sed -n 's/href="\([^"]\+\)"/\n&\n/gp' |
sed -n 's/^href="\([^"]\+\)"$/\1/p'; }
-curl -fsS "https://github.com/krebscode/painload/tree/master/retiolum/hosts" |
+if curl -fsS \
+ "https://github.com/krebscode/painload/tree/master/retiolum/hosts" |
_hrefs |
grep '^/krebscode/painload/blob/' |
grep -v "/blob/$old_commit/" >$temp1
-new_commit=`sed 's|^/krebscode/painload/blob/\([^/]*\)/.*|\1|;q' $temp1`
+ new_commit=`sed 's|^/krebscode/painload/blob/\([^/]*\)/.*|\1|;q' $temp1`
-sed '
- s|^/krebscode/painload/blob/[^/]*/retiolum/hosts/\([^/]*\)$|\1|
-' $temp1 > $temp2
+ sed '
+ s|^/krebscode/painload/blob/[^/]*/retiolum/hosts/\([^/]*\)$|\1|
+ ' $temp1 > $temp2
-xargs rm -v -f <$temp2
+ xargs rm -v -f <$temp2
-sed "
- s|^.*$|https://raw.github.com/krebscode/painload/$new_commit/retiolum/hosts/&|
-" $temp2 > $temp1
+ sed "
+ s|^.*$|https://raw.github.com/krebscode/painload/$new_commit/retiolum/hosts/&|
+ " $temp2 > $temp1
-wget -qi- < $temp1
+ wget -qi- < $temp1
-echo $new_commit > .commit
+ echo $new_commit > .commit
-pkill -HUP tincd
+ pkill -HUP tincd
+fi