2011-06-24 16:21:51 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2011-08-07 08:57:15 +00:00
|
|
|
[ -z "$IF_TINC_NET" ] && exit 0
|
2011-06-24 16:21:51 +00:00
|
|
|
|
|
|
|
# Read options from /etc/default
|
|
|
|
|
2011-08-07 08:57:15 +00:00
|
|
|
. /etc/default/tinc
|
2014-05-11 19:17:13 +00:00
|
|
|
|
2011-06-24 16:21:51 +00:00
|
|
|
# Read options from /etc/network/interfaces
|
|
|
|
|
|
|
|
[ -n "$IF_TINC_CONFIG" ] && EXTRA="$EXTRA -c $IF_TINC_CONFIG"
|
|
|
|
[ -n "$IF_TINC_DEBUG" ] && EXTRA="$EXTRA -d$IF_TINC_DEBUG"
|
|
|
|
[ -n "$IF_TINC_MLOCK" ] && EXTRA="$EXTRA --mlock"
|
|
|
|
[ -n "$IF_TINC_LOGFILE" ] && EXTRA="$EXTRA --logfile=$IF_TINC_LOGFILE"
|
|
|
|
[ -n "$IF_TINC_CHROOT" ] && EXTRA="$EXTRA --chroot"
|
|
|
|
[ -n "$IF_TINC_USER" ] && EXTRA="$EXTRA --user=$IF_TINC_USER"
|
|
|
|
|
|
|
|
# Start tinc daemon
|
|
|
|
|
|
|
|
/usr/sbin/tincd -n "$IF_TINC_NET" -o "Interface=$IFACE" $EXTRA
|
|
|
|
|
|
|
|
# Wait for it to come up properly
|
|
|
|
|
2011-08-07 08:57:15 +00:00
|
|
|
sleep 0.1
|
2011-06-24 16:21:51 +00:00
|
|
|
i=0;
|
2011-08-07 08:57:15 +00:00
|
|
|
while [ ! -f "/var/run/tinc.$IF_TINC_NET.pid" ] ; do
|
2011-06-24 16:21:51 +00:00
|
|
|
if [ $i = '30' ] ; then
|
|
|
|
echo 'Failed to start tinc daemon!'
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-08-07 08:57:15 +00:00
|
|
|
sleep 0.1
|
2011-06-24 16:21:51 +00:00
|
|
|
i=$(($i+1))
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|