2013-11-14 23:11:16 -07:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
|
|
|
START=99
|
|
|
|
boot() {
|
2014-11-12 22:25:41 -07:00
|
|
|
|
|
|
|
[ -x /usr/local/bin/bbhn-postupgrade ] && /usr/local/bin/bbhn-postupgrade
|
2015-04-05 22:03:50 -06:00
|
|
|
|
|
|
|
# extract auto-generated first boot switch config settings
|
|
|
|
# and store them for future use
|
|
|
|
if [ ! -f /etc/aredn_include/swconfig ]
|
|
|
|
then
|
|
|
|
mkdir -p /etc/aredn_include
|
2015-04-06 00:05:42 -06:00
|
|
|
touch /etc/aredn_include/swconfig
|
2015-04-05 22:03:50 -06:00
|
|
|
i=0
|
|
|
|
while true; do
|
|
|
|
uci -q get network.\@switch_vlan\[$i\] > /dev/null
|
|
|
|
local status=$?
|
|
|
|
if [ $status == 1 ]
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
echo "config switch_vlan" >> /etc/aredn_include/swconfig
|
|
|
|
echo " option device '`uci -q get network.\@switch_vlan\[$i\].device`'" >> /etc/aredn_include/swconfig
|
|
|
|
echo " option vlan '`uci -q get network.\@switch_vlan\[$i\].vlan`'" >> /etc/aredn_include/swconfig
|
|
|
|
echo " option ports '`uci -q get network.\@switch_vlan\[$i\].ports`'" >> /etc/aredn_include/swconfig
|
|
|
|
echo "" >> /etc/aredn_include/swconfig
|
|
|
|
let i++
|
|
|
|
done
|
|
|
|
|
|
|
|
i=0
|
|
|
|
while true; do
|
|
|
|
uci -q get network.\@switch_port\[$i\] > /dev/null
|
|
|
|
local status=$?
|
|
|
|
if [ $status == 1 ]
|
|
|
|
then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
echo "config switch_port" >> /etc/aredn_include/swconfig
|
|
|
|
echo " option device '`uci -q get network.\@switch_port\[$i\].device`'" >> /etc/aredn_include/swconfig
|
|
|
|
echo " option port '`uci -q get network.\@switch_port\[$i\].port`'" >> /etc/aredn_include/swconfig
|
|
|
|
echo " option pvid '`uci -q get network.\@switch_port\[$i\].pvid`'" >> /etc/aredn_include/swconfig
|
|
|
|
echo "" >> /etc/aredn_include/swconfig
|
|
|
|
let i++
|
|
|
|
done
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2015-04-06 00:04:32 -06:00
|
|
|
|
|
|
|
# Store the unique information about the card, such as its path, mac, and phy
|
|
|
|
# so it can be used later.
|
|
|
|
if [ ! -f /etc/aredn_include/radio0path ]
|
|
|
|
then
|
|
|
|
mkdir -p /etc/aredn_include
|
|
|
|
touch /etc/aredn_include/radio0path
|
|
|
|
local radio0path=`uci -q get wireless.radio0.path`
|
|
|
|
local radio0phy=`uci -q get wireless.radio0.phy`
|
|
|
|
local radio0mac=`uci -q get wireless.radio0.macaddr`
|
|
|
|
if [ "$radio0path" != "" ]
|
|
|
|
then
|
|
|
|
echo " option path '$radio0path'" >> /etc/aredn_include/radio0path
|
|
|
|
fi
|
|
|
|
if [ "$radio0phy" != "" ]
|
|
|
|
then
|
|
|
|
echo " option phy '$radio0phy'" >> /etc/aredn_include/radio0path
|
|
|
|
fi
|
|
|
|
if [ "$radio0mac" != "" ]
|
|
|
|
then
|
|
|
|
echo " option macaddr '$radio0mac'" >> /etc/aredn_include/radio0path
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2013-11-14 23:11:16 -07:00
|
|
|
# setup nvram variables
|
2013-12-02 13:04:54 -07:00
|
|
|
[ -x /usr/local/bin/nvram-setup ] && /usr/local/bin/nvram-setup
|
2013-11-14 23:11:16 -07:00
|
|
|
|
|
|
|
# run mode specific setup
|
|
|
|
[ -x /etc/config/local ] && /etc/config/local
|
2013-12-02 13:04:54 -07:00
|
|
|
[ -x /etc/local/services ] && /etc/local/services
|
2013-11-14 23:11:16 -07:00
|
|
|
}
|