Verify that batman is running after start

This commit is contained in:
Bob Mottram 2016-06-26 09:55:31 +01:00
parent 2bff9487f5
commit 1459693650
1 changed files with 140 additions and 125 deletions

View File

@ -88,10 +88,26 @@ if [ -e /etc/default/batctl ]; then
. /etc/default/batctl
fi
start() {
function status {
batctl o
}
function verify {
tempfile="$(mktemp)"
batctl o > $tempfile
if grep -q "disabled" $tempfile; then
echo $'B.A.T.M.A.N. not enabled'
rm $tempfile
exit 726835
fi
echo $'B.A.T.M.A.N. is running'
rm $tempfile
}
function start {
if [ -z "$IFACE" ] ; then
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
return
exit 723657
fi
echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
@ -151,6 +167,8 @@ start() {
iptables -A INPUT -p tcp --dport $IPFS_PORT -j ACCEPT
systemctl restart avahi-daemon
verify
}
stop() {
@ -196,7 +214,7 @@ if ! grep -q "$IFACE" /proc/net/dev; then
fi
case "$1" in
start|stop)
start|stop|status)
$1
;;
restart)
@ -204,9 +222,6 @@ case "$1" in
sleep 10
start
;;
status)
batctl o
;;
ping)
batctl ping $2
;;