summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/autostart
diff options
context:
space:
mode:
authorChinaman <root@chinaman>2011-09-06 19:47:58 +0200
committerChinaman <root@chinaman>2011-09-06 19:47:58 +0200
commit108f3616e3f4958752d881192ef29e5fc4c2b045 (patch)
tree3c67478c852265219b72e6e1b05467d7065b7ba8 /retiolum/scripts/autostart
parentb2d65500160bcdf7abb2bf985f7da582b810e25c (diff)
parentc3bc5a6d16868c121aca780f3109155797b51d76 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'retiolum/scripts/autostart')
-rw-r--r--retiolum/scripts/autostart/Makefile14
-rwxr-xr-xretiolum/scripts/autostart/create-startup.sh22
2 files changed, 22 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..37edb972
--- /dev/null
+++ b/retiolum/scripts/autostart/create-startup.sh
@@ -0,0 +1,22 @@
+#!/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
+
+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 $INIT_FOLDER