update the default rc.local based on dir300

Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
This commit is contained in:
Tim Niemeyer 2012-09-30 02:53:59 +02:00
parent 438b69d858
commit 6cd4a52e15

View File

@ -3,41 +3,47 @@
# batman seems to be to stupid to regocnice the devices # batman seems to be to stupid to regocnice the devices
# todo: uci.get .. # todo: uci.get ..
batctl if add eth0.3
batctl if add eth0.4
batctl if add wlan0-1 batctl if add wlan0-1
ifconfig eth0 mtu 1528 #echo none > /sys/devices/platform/ar231x-wmac.0/leds/ath5k-phy0\:\:rx/trigger
#echo phy0tx > /sys/devices/platform/ar231x-wmac.0/leds/ath5k-phy0\:\:tx/trigger
echo enable > /sys/devices/virtual/net/bat0/mesh/bridge_loop_avoidance
toLower() { toLower() {
echo $1 | sed -e "s/A/a/g" -e "s/B/b/g" -e "s/C/c/g" -e "s/D/d/g" -e "s/E/e/g" -e "s/F/f/g" echo $1 | sed -e "s/A/a/g" -e "s/B/b/g" -e "s/C/c/g" -e "s/D/d/g" -e "s/E/e/g" -e "s/F/f/g"
} }
# todo: all devices or only dir300 ? # todo: all devices or only dir300 ?
BRMAC=`ip link | grep br-mesh -A1 | grep link | awk '{ print $2 }'` if uci get network.mesh.macaddr
BRMAC=`toLower $BRMAC` then
WLMAC=`ip link | grep wlan0 -A1 | grep link | awk '{ print $2 }'` echo "MAC is set already"
WLMAC=`toLower $WLMAC` else
ETMAC=`ip link | grep eth0 -A1 | grep link | awk '{ print $2 }'` BRMAC=`ip link | grep br-mesh -A1 | grep link | awk '{ print $2 }'`
ETMAC=`toLower $ETMAC` BRMAC=`toLower $BRMAC`
WLMAC=`ip link | grep wlan0 -A1 | grep link | awk '{ print $2 }'`
WLMAC=`toLower $WLMAC`
ETMAC=`ip link | grep eth0 -A1 | grep link | awk '{ print $2 }'`
ETMAC=`toLower $ETMAC`
if [ "$WLMAC" != "" ] && [ "$BRMAC" != "" ] && [ "$BRMAC" = "$ETMAC" ]; then if [ "$WLMAC" != "" ] && [ "$BRMAC" != "" ] && [ "$BRMAC" = "$ETMAC" ]; then
if [[ "$BRMAC" != "$WLMAC" ]]; then if [[ "$BRMAC" != "$WLMAC" ]]; then
logger -s "Fixing wrong MAC on br-mesh" echo "Fixing wrong MAC on br-mesh"
uci set network.mesh.macaddr=$WLMAC uci set network.mesh.macaddr=$WLMAC
uci commit uci commit
ifconfig br-mesh hw ether $WLMAC ifconfig br-mesh hw ether $WLMAC
ifconfig br-mesh down ifconfig br-mesh down
ifconfig br-mesh up ifconfig br-mesh up
#wait before reboot to generate tinc certificates and to be able #wait before reboot to generate tinc certificates and to be able
#to login over ssh bevore reboot in case of errors #to login over ssh bevore reboot in case of errors
fi fi
fi
fi fi
# Starting NTP-Client Daemon # Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh" ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
sh /etc/firewall.user . /etc/firewall.user
/etc/init.d/qos disable /etc/init.d/qos disable
/etc/init.d/qos stop /etc/init.d/qos stop
@ -46,9 +52,4 @@ sh /etc/firewall.user
mkdir /tmp/crawldata mkdir /tmp/crawldata
httpd -h /tmp/crawldata httpd -h /tmp/crawldata
sh /etc/configurator.sh
#do something if a client associates
#iw event -f | /etc/clients_event.sh &
exit 0 exit 0