<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>BattleMeshV3/NodeConfigScript/Batman</title><revhistory><revision><revnumber>4</revnumber><date>2014-03-08 08:44:25</date><authorinitials>Clauz</authorinitials><revremark>Revert to revision 2.</revremark></revision><revision><revnumber>3</revnumber><date>2014-03-08 08:39:22</date><authorinitials>MBarlow</authorinitials></revision><revision><revnumber>2</revnumber><date>2010-06-04 13:41:26</date><authorinitials>T_X</authorinitials><revremark>adding batman-adv verbose logging stuff scripts (update of the WBM2 ones)</revremark></revision><revision><revnumber>1</revnumber><date>2010-03-23 19:59:35</date><authorinitials>ptr_here</authorinitials></revision></revhistory></articleinfo><para>BattleMeshV3/NodeConfigScript/Batman here. </para><section><title>batman-adv</title><para><emphasis role="strong">This one from the WBM2 not needed because of <ulink url="http://www.battlemesh.org/BattleMeshV3/NodeConfigScript/Batman/AllNodes#">AllNodes</ulink>-Config-Script</emphasis> </para><screen><![CDATA[
opkg update
opkg install kmod-batman-adv-kernelland
]]><![CDATA[
set -a
]]><![CDATA[
HOSTNAME="@PARAM1@"
WIRED_IP="@PARAM2@"
WIRELESS_IP="@PARAM3@"
CHANNEL="@PARAM4@"
CELL="@PARAM5@"
]]><![CDATA[
# 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
]]><![CDATA[
uci set wireless.$DEVICE.channel=$CHANNEL
uci set wireless.$DEVICE.hwmode=11g
uci set wireless.$DEVICE.txpower=20
]]><![CDATA[
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
]]><![CDATA[
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
]]><![CDATA[
#[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=""
]]><![CDATA[
]]><![CDATA[
]]><![CDATA[
uci set batman-adv-kernelland.general.interface="$DEVICE"
]]><![CDATA[
## Enabling syslogging to remote target ##
#
#uci set system.@system[0].log_ip="$LOG_IP"
]]><![CDATA[
uci commit
]]><![CDATA[
reboot
exit]]></screen><section><title>start/stop/loglevel config commands</title><section><title>Enable daemon</title><screen><![CDATA[[ -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
}]]></screen></section><section><title>Disable daemon</title><screen><![CDATA[[ -f /etc/init.d/batman-adv-kernelland ] && { 
  /etc/init.d/batman-adv stop 
  /etc/init.d/batman-adv disable 
}]]></screen></section><section><title>Enable batman-remote-logger</title><screen><![CDATA[[ -f /etc/init.d/batman-remote-logger.sh ] && {
  /etc/init.d/batman-remote-logger.sh enable
  /etc/init.d/batman-remote-logger.sh start
}]]></screen></section><section><title>Disable batman-remote-logger</title><screen><![CDATA[[ -f /etc/init.d/batman-remote-logger.sh ] && { 
  /etc/init.d/batman-remote-logger.sh stop 
  /etc/init.d/batman-remote-logger.sh disable 
}]]></screen></section><section><title>Verbose BATMAN log-level</title><screen><![CDATA[[ -f /usr/sbin/batctl ] && {
  batctl ll 3
}]]></screen></section><section><title>Quiet BATMAN log-level</title><screen><![CDATA[[ -f /usr/sbin/batctl ] && { batctl ll 0 }]]></screen></section></section><section><title>remote-logger.sh (on each node) WIP, untested yet!</title><screen><![CDATA[START=95
]]><![CDATA[
start () {
        # set up log server for blocking logfiles
        mkfifo /tmp/batman-adv.log
]]><![CDATA[
cat << EOF > /tmp/logserver.sh
#!/bin/sh
while [ 1 ]; do
        /usr/bin/netcat -l -p 2050 < /tmp/batman-adv.log
done
EOF
]]><![CDATA[
       # Log-piper
cat << EOF > /tmp/log-piper.sh
#!/bin/sh
while [ 1 ]; do
        dmesg | batctl l > /tmp/batman-adv.log
        sleep 3
done
EOF
]]><![CDATA[
        chmod 755 /tmp/logserver.sh
        chmod 755 /tmp/log-piper.sh
]]><![CDATA[
        /tmp/logserver.sh&
        /tmp/logpiper.sh&
}
]]><![CDATA[
stop () {
        killall logserver.sh
        killall log-piper.sh
        killall netcat
        rm /tmp/log-piper.sh
        rm /tmp/logserver.sh
        rm /tmp/batman-adv.log
}]]></screen></section></section></article>