summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--retiolum/Makefile14
-rwxr-xr-xretiolum/bin/pgrep-retiolum-tincd-args2
-rwxr-xr-xretiolum/bin/restart-tincd14
-rwxr-xr-xretiolum/scripts/tinc_setup/install.sh2
4 files changed, 24 insertions, 8 deletions
diff --git a/retiolum/Makefile b/retiolum/Makefile
index a7fa500a..7528ddd2 100644
--- a/retiolum/Makefile
+++ b/retiolum/Makefile
@@ -12,18 +12,20 @@ hosts:
install: update
../punani/bin/punani -Eih tinc /usr/bin/python /usr/bin/python2
- @# will not run automatically
scripts/tinc_setup/install.sh
+ cp scripts/tinc_setup/tinc-up /etc/tinc/retiolum/tinc-up
scripts/autostart/create-startup.sh
update: hosts
- @echo creating Magic
bin/update_tinc_hosts "create magic" || true
- @echo adding hosts
bin/update_tinc_hosts restart
- @echo reloading tincd
- sudo pkill -HUP tincd || true
- sudo pkill -ALRM tincd || true
+ if ! diff scripts/tinc_setup/tinc-up /etc/tinc/retiolum/tinc-up; then \
+ sudo cp scripts/tinc_setup/tinc-up /etc/tinc/retiolum/tinc-up; \
+ sudo bin/restart-tincd; \
+ else \
+ sudo pkill -HUP tincd || :; \
+ sudo pkill -ALRM tincd || :; \
+ fi
arch-install: update install arch-autostart autohosts
diff --git a/retiolum/bin/pgrep-retiolum-tincd-args b/retiolum/bin/pgrep-retiolum-tincd-args
new file mode 100755
index 00000000..bd0bbc97
--- /dev/null
+++ b/retiolum/bin/pgrep-retiolum-tincd-args
@@ -0,0 +1,2 @@
+#! /bin/sh
+ps -e -o args | grep -E '(^|[ /])tincd +.* (-n +|--net=)retiolum'
diff --git a/retiolum/bin/restart-tincd b/retiolum/bin/restart-tincd
new file mode 100755
index 00000000..17d939d9
--- /dev/null
+++ b/retiolum/bin/restart-tincd
@@ -0,0 +1,14 @@
+#! /bin/sh
+set -xeuf
+
+PATH="$(dirname $(readlink -f "$0"))${PATH+:$PATH}"
+
+if args="`pgrep-retiolum-tincd-args`"; then
+ while $args --kill; do
+ sleep 1
+ done
+ $args
+else
+ echo "$0: there is no retiolum tincd process to restart" >&2
+ exit 23
+fi
diff --git a/retiolum/scripts/tinc_setup/install.sh b/retiolum/scripts/tinc_setup/install.sh
index d1b284ac..1cd7c81d 100755
--- a/retiolum/scripts/tinc_setup/install.sh
+++ b/retiolum/scripts/tinc_setup/install.sh
@@ -60,8 +60,6 @@ else
echo "own host file already exists! will not write again!"
fi
-cp $CURR/tinc-up /etc/tinc/$netname/
-
cat>tinc.conf<<EOF
Name = $myname
ConnectTo = EUcancER