diff options
| author | Chinaman <root@chinaman> | 2011-09-06 19:47:58 +0200 |
|---|---|---|
| committer | Chinaman <root@chinaman> | 2011-09-06 19:47:58 +0200 |
| commit | 108f3616e3f4958752d881192ef29e5fc4c2b045 (patch) | |
| tree | 3c67478c852265219b72e6e1b05467d7065b7ba8 /retiolum/scripts/tinc_setup | |
| parent | b2d65500160bcdf7abb2bf985f7da582b810e25c (diff) | |
| parent | c3bc5a6d16868c121aca780f3109155797b51d76 (diff) | |
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'retiolum/scripts/tinc_setup')
| -rwxr-xr-x | retiolum/scripts/tinc_setup/install.sh | 18 | ||||
| -rw-r--r-- | retiolum/scripts/tinc_setup/write_channel.py | 1 |
2 files changed, 11 insertions, 8 deletions
diff --git a/retiolum/scripts/tinc_setup/install.sh b/retiolum/scripts/tinc_setup/install.sh index 9df38df7..526dbe1f 100755 --- a/retiolum/scripts/tinc_setup/install.sh +++ b/retiolum/scripts/tinc_setup/install.sh @@ -1,11 +1,18 @@ #! /bin/sh # USE WITH GREAT CAUTION +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 #make -C ../../ update 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 @@ -30,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!" diff --git a/retiolum/scripts/tinc_setup/write_channel.py b/retiolum/scripts/tinc_setup/write_channel.py index a11d4605..ee28674f 100644 --- a/retiolum/scripts/tinc_setup/write_channel.py +++ b/retiolum/scripts/tinc_setup/write_channel.py @@ -12,6 +12,7 @@ FILE="/etc/tinc/retiolum/hosts/"+myname PORT=6667 NICK= myname+"_"+str(random.randint(23,666)) +print "Connecting..." sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.connect((HOST,PORT)) print NICK |
