summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-27 17:07:04 +0200
committerFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-27 17:07:04 +0200
commite338c4d436efcb2661740a7d49fdc782b8a8a4e0 (patch)
tree44f201f07bbfaa8af4531654f3790ed05435f2ac /modules
parent402a70a9c1df350cf6911ec5b1372d7c1efdc6b4 (diff)
parent44f7bd49755aab8434fad4a42b96e68c7924fa19 (diff)
resolved conflict in install.sh
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/retiolum/bin/hosts11
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/install.sh15
-rwxr-xr-xmodules/retiolum/scripts/tinc_setup/tinc-up20
3 files changed, 33 insertions, 13 deletions
diff --git a/modules/retiolum/bin/hosts b/modules/retiolum/bin/hosts
new file mode 100755
index 00000000..e0a3d5fe
--- /dev/null
+++ b/modules/retiolum/bin/hosts
@@ -0,0 +1,11 @@
+#! /bin/sh
+set -euf
+
+netname=${1-retiolum}
+
+cd /etc/tinc/$netname/hosts
+
+for i in `ls`; do
+ sed -rn 's|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1\t'$i' '$i'.'$netname'|p' $i
+done
+
diff --git a/modules/retiolum/scripts/tinc_setup/install.sh b/modules/retiolum/scripts/tinc_setup/install.sh
index 8834aafc..de7d2225 100755
--- a/modules/retiolum/scripts/tinc_setup/install.sh
+++ b/modules/retiolum/scripts/tinc_setup/install.sh
@@ -4,7 +4,7 @@
make -C ../../ update
set -e
-CURR=`pwd`
+CURR=`dirname "$0"`
MYBIN=../../bin
netname=retiolum
# create configuration directory for $netname
@@ -47,18 +47,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