From 8e53737ac57d1866d92b01f73a8e6040fff482e2 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 12 Aug 2011 23:02:56 +0200 Subject: retiolum/autostart: makefile now script script updates the startup scripts and stuff. does the right thing (most of the time) --- retiolum/scripts/autostart/Makefile | 14 -------------- retiolum/scripts/autostart/create-startup.sh | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 retiolum/scripts/autostart/Makefile create mode 100755 retiolum/scripts/autostart/create-startup.sh (limited to 'retiolum/scripts') 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 -- cgit v1.2.3 From 5ea389182e56c6189e418deff8df282f393f9eb4 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 12 Aug 2011 23:14:27 +0200 Subject: retiolum tinc_setup: go sudo --- retiolum/scripts/tinc_setup/install.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'retiolum/scripts') diff --git a/retiolum/scripts/tinc_setup/install.sh b/retiolum/scripts/tinc_setup/install.sh index 9df38df7..0902d417 100755 --- a/retiolum/scripts/tinc_setup/install.sh +++ b/retiolum/scripts/tinc_setup/install.sh @@ -1,5 +1,12 @@ #! /bin/sh # USE WITH GREAT CAUTION +set -euf + +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 #make -C ../../ update set -e -- cgit v1.2.3 From 2048448601aa27f993268ef67bf0eeda3625ef4e Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 12 Aug 2011 23:23:33 +0200 Subject: retiolum: go more enterprise --- retiolum/scripts/autostart/create-startup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'retiolum/scripts') 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 -- cgit v1.2.3 From 56dec36bdcb05d59eb0feef63bf866bc78bba49f Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 13 Aug 2011 16:19:33 +0200 Subject: tinc_setup/install.sh: update failsafe behavior install script checks if the chosen ip is already taken. --- retiolum/scripts/tinc_setup/install.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'retiolum/scripts') diff --git a/retiolum/scripts/tinc_setup/install.sh b/retiolum/scripts/tinc_setup/install.sh index 0902d417..526dbe1f 100755 --- a/retiolum/scripts/tinc_setup/install.sh +++ b/retiolum/scripts/tinc_setup/install.sh @@ -1,6 +1,6 @@ #! /bin/sh # USE WITH GREAT CAUTION -set -euf +set -eu if test "${nosudo-false}" != true -a `id -u` != 0; then echo "we're going sudo..." >&2 @@ -12,7 +12,7 @@ fi set -e DIRNAME=`dirname $0` CURR=`readlink -f ${DIRNAME}` -MYBIN=../../bin +MYBIN=${CURR}/../../bin netname=retiolum # create configuration directory for $netname mkdir -p /etc/tinc/$netname/hosts @@ -37,18 +37,13 @@ then then echo "select v4 subnet ip (1-255) :" read v4num - myipv4=10.7.7.$v4num - if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ]; - then - echo "check" - else - echo "you are made of stupid. bailing out" + if ! $MYBIN/check-free-retiolum-v4 $v4num;then exit 1 fi fi echo "Subnet = $myipv4" > hosts/$myname - myipv6=`${CURR}/../../bin/fillxx 42:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx`/128 + myipv6=`$MYBIN/fillxx 42:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx`/128 echo "Subnet = $myipv6" >> hosts/$myname else echo "own host file already exists! will not write again!" -- cgit v1.2.3