summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-02-12 16:48:50 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-02-12 16:48:50 +0100
commitdbf5d2834a4e912a9787201313219a817b5c26a4 (patch)
tree8de977a5d8fc8995f1d7e5c2757c9eb3904ecf37
parente9be45fa1cc955ff8a0e497f8fd3ed7521d0b5a1 (diff)
downloadhosts-dbf5d2834a4e912a9787201313219a817b5c26a4.tar.gz
hosts-dbf5d2834a4e912a9787201313219a817b5c26a4.tar.zst
hosts-dbf5d2834a4e912a9787201313219a817b5c26a4.zip
Adjust scripts to remove the need of tinc_domaine
-rwxr-xr-xImmaeEu-down11
-rwxr-xr-xImmaeEu-up14
2 files changed, 13 insertions, 12 deletions
diff --git a/ImmaeEu-down b/ImmaeEu-down
index d5e9ccf..8dc9fc4 100755
--- a/ImmaeEu-down
+++ b/ImmaeEu-down
@@ -1,11 +1,12 @@
1#!/bin/sh 1#!/bin/sh
2# This file closes down the tap device. 2# This file closes down the tap device.
3 3
4. /tmp/tinc_$NETNAME 4[ -e /tmp/tinc_$NETNAME ] && . /tmp/tinc_$NETNAME
5rm -f /tmp/tinc_$NETNAME 5[ -e /run/tinc_$NETNAME.vars ] && . /run/tinc_$NETNAME.vars
6ip -6 route del default via $GWIP 6rm -f /tmp/tinc_$NETNAME /run/tinc_$NETNAME.vars
7for MYIP in $MYIPS; do 7[ -n "$GWIP" ] && ip -6 route del default via $GWIP
8 ip -6 addr del $MYIP/96 dev $INTERFACE 8for MYIP in "$MYIPS"; do
9 ip -6 addr del $MYIP/96 dev $INTERFACE
9done 10done
10ip -6 link set $INTERFACE down 11ip -6 link set $INTERFACE down
11 12
diff --git a/ImmaeEu-up b/ImmaeEu-up
index 56710a1..c2dc93a 100755
--- a/ImmaeEu-up
+++ b/ImmaeEu-up
@@ -8,17 +8,17 @@
8# Give it the right ip and netmask. Remember, the subnet of the 8# Give it the right ip and netmask. Remember, the subnet of the
9# tap device must be larger than that of the individual Subnets 9# tap device must be larger than that of the individual Subnets
10# as defined in the host configuration file! 10# as defined in the host configuration file!
11SUBDOMAIN=`cat /etc/tinc/$NETNAME/tinc_domaine` 11SUBDOMAIN=$(echo "$NAME" | sed -e "s/\([A-Z][a-z0-9]*\)/\L\1 /g;" | awk '{ for (i=NF; i>1; i--) printf("%s.",$i); print $1; }')
12while [ -z "$MYIPS" -o -z "$GWIP" ]; do 12while [ -z "$MYIPS" -o -z "$GWIP" ]; do
13 MYIPS=`getent hosts ${SUBDOMAIN}.immae.eu | cut -d' ' -f1 | tr "\\n" ' '` 13 MYIPS=`getent hosts ${SUBDOMAIN}.immae.eu | cut -d' ' -f1 | tr "\\n" ' '`
14 GWIP=`getent hosts gw.vpn.immae.eu | head -n1 | cut -d' ' -f1` 14 GWIP=`getent hosts gw.vpn.immae.eu | head -n1 | cut -d' ' -f1`
15 sleep 5 15 sleep 5
16done 16done
17rm -f /tmp/tinc_$NETNAME 17rm -f /run/tinc_$NETNAME.vars
18echo -e "MYIPS=\"$MYIPS\"\nGWIP=\"$GWIP\"" > /tmp/tinc_$NETNAME 18echo -e "MYIPS=\"$MYIPS\"\nGWIP=\"$GWIP\"" > /run/tinc_$NETNAME.vars
19ip -6 link set $INTERFACE up mtu 1280 19ip -6 link set $INTERFACE up mtu 1280
20for MYIP in $MYIPS; do 20for MYIP in $MYIPS; do
21 ip -6 addr add $MYIP/96 dev $INTERFACE 21 ip -6 addr add $MYIP/96 dev $INTERFACE
22done 22done
23ip -6 route add default via $GWIP 23ip -6 route add default via $GWIP
24(cd /etc/tinc/$NETNAME/hosts && git pull -q origin master) || true 24(cd /etc/tinc/$NETNAME/hosts && git pull -q origin master) || true