welcome: please sign in
location: BattleMeshV3 / NodeConfigScript / Batman

BattleMeshV3/NodeConfigScript/Batman here.

batman-adv

This one from the WBM2 not needed because of AllNodes-Config-Script


opkg update
opkg install kmod-batman-adv-kernelland

set -a

HOSTNAME="@PARAM1@"
WIRED_IP="@PARAM2@"
WIRELESS_IP="@PARAM3@"
CHANNEL="@PARAM4@"
CELL="@PARAM5@"

# setting wireless config
DEVICE=`uci get wireless.@wifi-iface[0].device`
uci delete wireless.$DEVICE.disabled
uci delete wireless.@wifi-iface[0].network
#uci delete wireless.@wifi-iface[0].rate

uci set wireless.$DEVICE.channel=$CHANNEL
uci set wireless.$DEVICE.hwmode=11g
uci set wireless.$DEVICE.txpower=20

uci set wireless.@wifi-iface[0].network=wlan
uci set wireless.@wifi-iface[0].ssid=wbm_batman
uci set wireless.@wifi-iface[0].encryption=none
uci set wireless.@wifi-iface[0].bssid=$CELL
uci set wireless.@wifi-iface[0].rate=54M
uci set wireless.@wifi-iface[0].bgscan=0
uci set wireless.@wifi-iface[0].mode=ahdemo

uci set network.wlan=interface
uci set network.wlan.proto=static
uci set network.wlan.ipaddr=$WIRELESS_IP
uci set network.wlan.netmask=255.255.255.0
uci commit wireless && wifi
uci commit network

#[edit] Configure the daemon
#
uci set network.batman=interface
uci set network.batman.ifname=bat0
uci set network.batman.proto=static
uci set network.batman.ipaddr=$WIRELESS_IP
uci set network.batman.netmask=255.255.255.0
#uci set network.batman.gateway=""



uci set batman-adv-kernelland.general.interface="$DEVICE"

## Enabling syslogging to remote target ##
#
#uci set system.@system[0].log_ip="$LOG_IP"

uci commit

reboot
exit

start/stop/loglevel config commands

Enable daemon

[ -f /etc/init.d/batman-adv-kernelland ] && {
  /etc/init.d/batman-adv enable
  /etc/init.d/batman-adv start
} || {
  echo "ERROR: couldn't find batman init scripts, exiting..."
  exit 1
}

Disable daemon

[ -f /etc/init.d/batman-adv-kernelland ] && { 
  /etc/init.d/batman-adv stop 
  /etc/init.d/batman-adv disable 
}

Enable batman-remote-logger

[ -f /etc/init.d/batman-remote-logger.sh ] && {
  /etc/init.d/batman-remote-logger.sh enable
  /etc/init.d/batman-remote-logger.sh start
}

Disable batman-remote-logger

[ -f /etc/init.d/batman-remote-logger.sh ] && { 
  /etc/init.d/batman-remote-logger.sh stop 
  /etc/init.d/batman-remote-logger.sh disable 
}

Verbose BATMAN log-level

[ -f /usr/sbin/batctl ] && {
  batctl ll 3
}

Quiet BATMAN log-level

[ -f /usr/sbin/batctl ] && { batctl ll 0 }

remote-logger.sh (on each node) WIP, untested yet!

START=95

start () {
        # set up log server for blocking logfiles
        mkfifo /tmp/batman-adv.log

cat << EOF > /tmp/logserver.sh
#!/bin/sh
while [ 1 ]; do
        /usr/bin/netcat -l -p 2050 < /tmp/batman-adv.log
done
EOF

       # Log-piper
cat << EOF > /tmp/log-piper.sh
#!/bin/sh
while [ 1 ]; do
        dmesg | batctl l > /tmp/batman-adv.log
        sleep 3
done
EOF

        chmod 755 /tmp/logserver.sh
        chmod 755 /tmp/log-piper.sh

        /tmp/logserver.sh&
        /tmp/logpiper.sh&
}

stop () {
        killall logserver.sh
        killall log-piper.sh
        killall netcat
        rm /tmp/log-piper.sh
        rm /tmp/logserver.sh
        rm /tmp/batman-adv.log
}

BattleMeshV3/NodeConfigScript/Batman (last edited 2014-03-08 08:44:25 by Clauz)