Skip to content

Commit

Permalink
Merge pull request freifunk-gluon#8 from grische/reduce-nesting-check…
Browse files Browse the repository at this point in the history
…_batman

ffbs-mesh-vpn-parker: reduce nesting in noderoute
  • Loading branch information
SmithChart authored Nov 27, 2024
2 parents 35b7dc7 + d77cc2d commit 3cefe3c
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions ffbs-mesh-vpn-parker/files/usr/sbin/noderoute.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/busybox sh
# simple script to loop noderoute lua script

tmpdir=/tmp/ff-Ohb0ba0u/
Expand All @@ -8,20 +8,18 @@ $LOGGER Starting up.

check_batman() {
# check if we have a functional batman-setup
if ip l | grep -q "bat0:"; then
# we have a bat0-interface. let's do some checks
if ! ip l | grep -q "bat0:"; then
$LOGGER ERROR: No BATMAN-interface found
return 1
fi

if ip l | grep "bat0:" | grep -q DOWN; then
$LOGGER ERROR: BATMAN-interface is not up
return 1
fi
if ip l | grep "bat0:" | grep -q DOWN; then
$LOGGER ERROR: BATMAN-interface is not up
return 1
fi

if ! ip l | grep "bat0:" | grep -q br-client; then
$LOGGER ERROR: bat0 not part of br-client
return 1
fi
else
$LOGGER ERROR: No BATMAN-interface found
if ! ip l | grep "bat0:" | grep -q br-client; then
$LOGGER ERROR: bat0 not part of br-client
return 1
fi
return 0
Expand All @@ -39,12 +37,12 @@ while true; do
# sanity check: is uradvd running?
if ! pidof uradvd > /dev/null; then
$LOGGER ERROR: NO URADVD RUNNING.
fi
fi

# sanity check: does dnsmasq have a valid config?
if ! grep -qF "dhcp-range=set:client" /var/etc/dnsmasq.conf.cfg*; then
$LOGGER ERROR: NO DHCP-RANGE IN dnsmasq.conf.
fi
fi
fi

while (! check_batman); do
Expand Down

0 comments on commit 3cefe3c

Please sign in to comment.