summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-08-12 23:02:56 +0200
committermakefu <github@syntax-fehler.de>2011-08-12 23:02:56 +0200
commit8e53737ac57d1866d92b01f73a8e6040fff482e2 (patch)
tree032d32086da147ac4825d0df09e65678bcf6eb4a
parent7dd2e8a2a48cca041e0afac5b12cd4a45d0a907f (diff)
retiolum/autostart: makefile now script
script updates the startup scripts and stuff. does the right thing (most of the time)
-rw-r--r--retiolum/scripts/autostart/Makefile14
-rwxr-xr-xretiolum/scripts/autostart/create-startup.sh17
2 files changed, 17 insertions, 14 deletions
diff --git a/retiolum/scripts/autostart/Makefile b/retiolum/scripts/autostart/Makefile
deleted file mode 100644
index aba6bd33..00000000
--- a/retiolum/scripts/autostart/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-INIT_FOLDER=/etc/init.d
-.phony: all
-debian:
- #TODO change the tinc file before writing
- cp tinc /etc/init.d/tinc
- chmod +x /etc/init.d
- echo "retiolum" > /etc/tinc/nets.boot
- update-rc.d tinc defaults
-arch:
- @cp tinc /etc/rc.d
- @chmod +x /etc/rc.d/tinc
- @echo "add tinc to DAEMONS in /etc/rc.conf"
-
-
diff --git a/retiolum/scripts/autostart/create-startup.sh b/retiolum/scripts/autostart/create-startup.sh
new file mode 100755
index 00000000..3513a515
--- /dev/null
+++ b/retiolum/scripts/autostart/create-startup.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+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
+
+if [ -e /etc/init.d ];then
+ INIT_FOLDER=/etc/init.d
+ update-rc.d tinc defaults #TODO debian specific
+else
+ echo "add tinc to DAEMONS in /etc/rc.conf" #TODO archlinux specific
+fi
+
+echo "retiolum" > /etc/tinc/nets.boot
+cp -a tinc $INITFOLDER