summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/install.sh16
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/tinc-up20
2 files changed, 22 insertions, 14 deletions
diff --git a/modules/retiolum/scripts/tinc_setup/install.sh b/modules/retiolum/scripts/tinc_setup/install.sh
index b7679041..f472f217 100755
--- a/modules/retiolum/scripts/tinc_setup/install.sh
+++ b/modules/retiolum/scripts/tinc_setup/install.sh
@@ -5,8 +5,7 @@ make -C ../../ update
set -e
-
-CURR=`pwd`
+CURR=`dirname "$0"`
MYBIN=../../bin
netname=penisland
# create configuration directory for $netname
@@ -49,18 +48,7 @@ else
echo "own host file already exists! will not write again!"
fi
-
-myipv6=${myipv6:-`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' /etc/tinc/$netname/hosts/$myname`}
-
-cat>tinc-up<<EOF
-#! /bin/sh
-ifconfig \$INTERFACE up $myipv4/24
-route add -net $mynet4/24 dev \$INTERFACE
-ip -6 addr add ${myipv6} dev \$INTERFACE
-ip -6 route add 42::/16 dev \$INTERFACE
-EOF
-
-chmod +x tinc-up
+cp $CURR/tinc-up .
cat>tinc.conf<<EOF
Name = $myname
diff --git a/modules/retiolum/scripts/tinc_setup/tinc-up b/modules/retiolum/scripts/tinc_setup/tinc-up
new file mode 100755
index 00000000..9e6148da
--- /dev/null
+++ b/modules/retiolum/scripts/tinc_setup/tinc-up
@@ -0,0 +1,20 @@
+# source: krebscode/painload/modules/retiolum/scripts/tinc_setup/tinc-up
+
+dirname="`dirname "$0"`"
+
+conf=$dirname/tinc.conf
+
+name=`sed -rn 's|^ *Name *= *([^ ]*) *$|\1|p' $conf`
+
+host=$dirname/hosts/$name
+
+route4=10.7.7.0/24
+addr4=`sed -rn 's|^ *Subnet *= *(10\.[^ ]*) *$|\1|p' $host`
+
+route6=42::/16
+addr6=`sed -rn 's|^ *Subnet *= *(42:[^ ]*) *$|\1|p' $host`
+
+ifconfig $INTERFACE up $addr4
+route add -net $route4 dev $INTERFACE
+ip -6 addr add $addr6 dev $INTERFACE
+ip -6 route add $route6 dev $INTERFACE