firmware/bsp/default/root_file_system/etc/rc.local

47 lines
1.3 KiB
Plaintext
Executable File

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# collect environment info and write to dot-script
/etc/environment.sh > /tmp/environment
# todo: all devices or only dir300 ?
if uci get network.mesh.macaddr
then
echo "MAC is set already"
else
BRMAC=$(awk '{ tolower($0); print }' /sys/class/net/br-mesh/address)
WLMAC=$(awk '{ tolower($0); print }' /sys/class/net/wlan0/address)
ETMAC=$(awk '{ tolower($0); print }' /sys/class/net/eth0/address)
if [ "$WLMAC" != "" ] && [ "$BRMAC" != "" ] && [ "$BRMAC" = "$ETMAC" ]; then
if [[ "$BRMAC" != "$WLMAC" ]]; then
echo "Fixing wrong MAC on br-mesh"
uci set network.mesh.macaddr=$WLMAC
uci commit
ifconfig br-mesh hw ether $WLMAC
ifconfig br-mesh down
ifconfig br-mesh up
#wait before reboot to generate tinc certificates and to be able
#to login over ssh bevore reboot in case of errors
fi
fi
fi
batctl if add wlan0-1
batctl if add br-ethmesh1
batctl if add br-ethmesh2
# Starting NTP-Client Daemon
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
. /etc/firewall.user
/etc/init.d/qos disable
/etc/init.d/qos stop
#busybox-httpd for crawldata
mkdir /tmp/crawldata
httpd -h /tmp/crawldata
exit 0