Tidy batman script

This commit is contained in:
Bob Mottram 2015-08-09 09:31:01 +01:00
parent 913c277d65
commit 85f576a093
2 changed files with 12 additions and 14 deletions

View File

@ -1784,7 +1784,10 @@ function mesh_batman_bridge {
echo 'BRIDGE=br-mesh' >> $batman_script
echo 'IFACE=wlan0' >> $batman_script
echo 'EIFACE=eth0' >> $batman_script
echo 'IFACE_EXISTS=$(grep "$IFACE" /proc/net/dev)' >> $batman_script
echo '' >> $batman_script
echo 'if grep -q "wlan1" /proc/net/dev; then' >> $batman_script
echo ' IFACE=wlan1' >> $batman_script
echo 'fi' >> $batman_script
echo '' >> $batman_script
echo 'if [ -e /etc/default/batctl ]; then' >> $batman_script
echo ' . /etc/default/batctl' >> $batman_script
@ -1812,9 +1815,7 @@ function mesh_batman_bridge {
echo ' modprobe batman-adv' >> $batman_script
echo ' batctl if add $IFACE' >> $batman_script
echo ' ifconfig $IFACE up' >> $batman_script
echo ' avahi-autoipd -D $IFACE' >> $batman_script
echo ' avahi-autoipd -D bat0' >> $batman_script
echo ' avahi-autoipd -D $BRIDGE' >> $batman_script
echo ' ifconfig bat0 up promisc' >> $batman_script
echo '' >> $batman_script
echo ' #Use persistent HWAddr' >> $batman_script
@ -1827,7 +1828,7 @@ function mesh_batman_bridge {
echo ' ifconfig bat0 hw ether ${ether}' >> $batman_script
echo ' fi' >> $batman_script
echo '' >> $batman_script
echo ' if [ "$EIFACE" ] ; then' >> $batman_script
echo ' if [ "$EIFACE" ]; then' >> $batman_script
echo ' brctl addbr $BRIDGE' >> $batman_script
echo ' brctl addif $BRIDGE bat0' >> $batman_script
echo ' brctl addif $BRIDGE $EIFACE' >> $batman_script
@ -1857,21 +1858,19 @@ function mesh_batman_bridge {
echo ' ifconfig $EIFACE down -promisc' >> $batman_script
echo ' fi' >> $batman_script
echo '' >> $batman_script
echo ' avahi-autoipd -k bat0' >> $batman_script
echo ' ifconfig bat0 down -promisc' >> $batman_script
echo '' >> $batman_script
echo ' batctl if del $IFACE' >> $batman_script
echo ' rmmod batman-adv' >> $batman_script
echo ' ifconfig $IFACE mtu 1500' >> $batman_script
echo ' ifconfig $IFACE down' >> $batman_script
echo ' avahi-autoipd -k $IFACE' >> $batman_script
echo ' avahi-autoipd -k bat0' >> $batman_script
echo ' avahi-autoipd -k $BRIDGE' >> $batman_script
echo ' iwconfig $IFACE mode managed' >> $batman_script
echo '' >> $batman_script
echo ' systemctl restart network-manager' >> $batman_script
echo '}' >> $batman_script
echo '' >> $batman_script
echo 'if [ ! $IFACE_EXISTS ]; then' >> $batman_script
echo 'if ! grep -q "$IFACE" /proc/net/dev; then' >> $batman_script
echo ' echo "Interface $IFACE was not found"' >> $batman_script
echo ' stop' >> $batman_script
echo ' exit 1' >> $batman_script
@ -1886,12 +1885,15 @@ function mesh_batman_bridge {
echo ' sleep 10' >> $batman_script
echo ' start' >> $batman_script
echo ' ;;' >> $batman_script
echo ' status)' >> $batman_script
echo ' batctl o' >> $batman_script
echo ' ;;' >> $batman_script
echo ' ls|list)' >> $batman_script
echo ' avahi-browse -at' >> $batman_script
echo ' ;;' >> $batman_script
echo ' *)' >> $batman_script
echo ' echo "error: invalid parameter $1"' >> $batman_script
echo ' echo "usage: $0 {start|stop|restart|list|ls}"' >> $batman_script
echo ' echo "usage: $0 {start|stop|restart|status|list|ls}"' >> $batman_script
echo ' exit 2' >> $batman_script
echo ' ;;' >> $batman_script
echo 'esac' >> $batman_script

View File

@ -214,9 +214,7 @@ function mesh_batman {
echo ' modprobe batman-adv' >> $batman_script
echo ' batctl if add $IFACE' >> $batman_script
echo ' ifconfig $IFACE up' >> $batman_script
echo ' avahi-autoipd -D $IFACE' >> $batman_script
echo ' avahi-autoipd -D bat0' >> $batman_script
echo ' avahi-autoipd -D $BRIDGE' >> $batman_script
echo ' ifconfig bat0 up promisc' >> $batman_script
echo '' >> $batman_script
echo ' #Use persistent HWAddr' >> $batman_script
@ -261,15 +259,13 @@ function mesh_batman {
echo ' ifconfig $EIFACE down -promisc' >> $batman_script
echo ' fi' >> $batman_script
echo '' >> $batman_script
echo ' avahi-autoipd -k bat0' >> $batman_script
echo ' ifconfig bat0 down -promisc' >> $batman_script
echo '' >> $batman_script
echo ' batctl if del $IFACE' >> $batman_script
echo ' rmmod batman-adv' >> $batman_script
echo ' ifconfig $IFACE mtu 1500' >> $batman_script
echo ' ifconfig $IFACE down' >> $batman_script
echo ' avahi-autoipd -k $IFACE' >> $batman_script
echo ' avahi-autoipd -k bat0' >> $batman_script
echo ' avahi-autoipd -k $BRIDGE' >> $batman_script
echo ' iwconfig $IFACE mode managed' >> $batman_script
echo '' >> $batman_script
echo ' iptables -D INPUT -i $IFACE -p udp --dport 5353 -j ACCEPT' >> $batman_script