summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--retiolum/Makefile22
-rwxr-xr-xretiolum/bin/update-retiolum-hosts11
-rwxr-xr-xretiolum/scripts/autostart/create-startup.sh7
3 files changed, 25 insertions, 15 deletions
diff --git a/retiolum/Makefile b/retiolum/Makefile
index e58e2ece..407d8c60 100644
--- a/retiolum/Makefile
+++ b/retiolum/Makefile
@@ -1,27 +1,21 @@
-RETIOLUM_HOSTS = /etc/tinc/retiolum/hosts
+.PHONY: update all install hosts
-.PHONY: update it all so install
+EXES := update_tinc_hosts fillxx update-retiolum-hosts
all: update links
-links:
- ln -sf $$PWD/bin/update_tinc_hosts ../bin/update_tinc_hosts
- ln -sf $$PWD/bin/fillxx ../bin/fillxx
-
-it: so
-so: it
-
-hosts/:
- @echo "Writing new copy of hosts"
- [ -e $(RETIOLUM_HOSTS) ] || mkdir -p $(RETIOLUM_HOSTS)
- cp -r hosts/* $(RETIOLUM_HOSTS)/
+links:
+ for x in $(EXES); do ln -vsnf ../retiolum/bin/$$x ../bin; done
+hosts:
+ bin/update-retiolum-hosts
install: update
@# will not run automatically
scripts/tinc_setup/install.sh
+ scripts/autostart/create-startup.sh
-update: hosts/
+update: hosts
@echo creating Magic
bin/update_tinc_hosts "create magic" || true
@echo adding hosts
diff --git a/retiolum/bin/update-retiolum-hosts b/retiolum/bin/update-retiolum-hosts
new file mode 100755
index 00000000..57a8381a
--- /dev/null
+++ b/retiolum/bin/update-retiolum-hosts
@@ -0,0 +1,11 @@
+#! /bin/sh
+set -eu
+
+if test "${nosudo-false}" != true -a `id -u` != 0; then
+ echo "we're going sudo..." >&2
+ exec sudo "$0" "$@"
+ exit 23 # go to hell
+fi
+
+mkdir -v -p /etc/tinc/retiolum/hosts
+cp -v -r hosts/* /etc/tinc/retiolum/hosts
diff --git a/retiolum/scripts/autostart/create-startup.sh b/retiolum/scripts/autostart/create-startup.sh
index 3513a515..37edb972 100755
--- a/retiolum/scripts/autostart/create-startup.sh
+++ b/retiolum/scripts/autostart/create-startup.sh
@@ -6,12 +6,17 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then
exit 23 # go to hell
fi
+readlink="`readlink -f "$0"`"
+dirname="`dirname "$0"`"
+cd "$dirname"
+
if [ -e /etc/init.d ];then
INIT_FOLDER=/etc/init.d
update-rc.d tinc defaults #TODO debian specific
else
+ INIT_FOLDER=/etc/rc.d
echo "add tinc to DAEMONS in /etc/rc.conf" #TODO archlinux specific
fi
echo "retiolum" > /etc/tinc/nets.boot
-cp -a tinc $INITFOLDER
+cp -a tinc $INIT_FOLDER