forked from freifunk-franken/firmware
updated tincstart also for trunk
This commit is contained in:
parent
8402caa1e5
commit
af32bd619f
|
@ -39,11 +39,13 @@ fi
|
|||
if [ ! -d /etc/tinc/$project ]
|
||||
then
|
||||
mkdir /etc/tinc/$project
|
||||
ln -s /tmp/tinc_$project.conf /etc/tinc/$project/tinc.conf
|
||||
|
||||
echo -n -e "\n\n" | tincd --pidfile=/etc/tinc/$project/tinc.pid -n $project -K
|
||||
kill -HUP $(cat /etc/tinc/$project/tinc.pid)
|
||||
echo -n -e "\n\n" | tincd --pidfile=/var/run/tinc_$project.pid -n $project -K
|
||||
kill -HUP $(cat /var/run/tinc_$project.pid)
|
||||
sleep 3
|
||||
mkdir /etc/tinc/$project/hosts
|
||||
mkdir /tmp/tinc_${project}_hosts
|
||||
ln -s /tmp/tinc_${project}_hosts /etc/tinc/$project/hosts
|
||||
echo "ifconfig \$INTERFACE up" > /etc/tinc/$project/tinc-up
|
||||
if [ "$SERVER" == "no" ]
|
||||
then
|
||||
|
@ -52,6 +54,11 @@ then
|
|||
chmod +x /etc/tinc/$project/tinc-up
|
||||
fi
|
||||
|
||||
if [ ! -d /tmp/tinc_${project}_hosts ]
|
||||
then
|
||||
mkdir /tmp/tinc_${project}_hosts
|
||||
fi
|
||||
|
||||
pubkey=$(for line in $(cat /etc/tinc/$project/rsa_key.pub | sed -e 's/$/%0a/g' | sed -e 's/+/%2b/g' | sed -e 's/ /%20/g'); do echo -n $line; done)
|
||||
port=666
|
||||
|
||||
|
@ -77,18 +84,18 @@ fi
|
|||
# fire up
|
||||
if [ "$(ps aux | grep tincd | grep -v grep)" == "" ]
|
||||
then
|
||||
tincd -c /etc/tinc/$project --pidfile=/etc/tinc/$project/tinc.pid --logfile=/var/log/tinc.log $DEBUG
|
||||
tincd -c /etc/tinc/$project --pidfile=/var/run/tinc_$project.pid --logfile=/var/log/tinc_$project.log $DEBUG
|
||||
# sleep 1
|
||||
# brctl addif br-mesh tap0
|
||||
fi
|
||||
|
||||
# register
|
||||
wget -T15 "http://mastersword.de/~reddog/tinc/?name=$hostname&port=$port&key=$pubkey" -O /etc/tinc/$project/output
|
||||
wget -T15 "http://mastersword.de/~reddog/tinc/?name=$hostname&port=$port&key=$pubkey" -O /tmp/tinc_${project}_output
|
||||
|
||||
filenames=$(cat /etc/tinc/$project/output| grep ^#### | sed -e 's/^####//' | sed -e 's/.conf//g')
|
||||
filenames=$(cat /tmp/tinc_${project}_output| grep ^#### | sed -e 's/^####//' | sed -e 's/.conf//g')
|
||||
for file in $filenames
|
||||
do
|
||||
grep -A100 $file /etc/tinc/$project/output | grep -v $file | grep -m1 ^### -B100 | grep -v ^### > /etc/tinc/$project/hosts/$file.new
|
||||
grep -A100 $file /tmp/tinc_${project}_output | grep -v $file | grep -m1 ^### -B100 | grep -v ^### > /etc/tinc/$project/hosts/$file.new
|
||||
if [ "$(diff /etc/tinc/$project/hosts/$file.new /etc/tinc/$project/hosts/$file 2>&1)" == "" ]
|
||||
then
|
||||
/bin/rm /etc/tinc/$project/hosts/$file.new
|
||||
|
@ -108,7 +115,7 @@ cat /etc/tinc/$project/rsa_key.pub >> /etc/tinc/$project/hosts/$hostname
|
|||
fi
|
||||
|
||||
#reload
|
||||
kill -HUP $(cat /etc/tinc/$project/tinc.pid)
|
||||
kill -HUP $(cat /var/run/tinc_$project.pid)
|
||||
|
||||
else
|
||||
echo "Der Router kann keine Verbindung zum Tincserver aufbauen"
|
||||
|
|
Loading…
Reference in New Issue
Block a user