diff --git a/files/etc/init.d/local b/files/etc/init.d/local index 4705cdc0..39421c03 100755 --- a/files/etc/init.d/local +++ b/files/etc/init.d/local @@ -6,114 +6,6 @@ boot() { [ -x /usr/local/bin/bbhn-postupgrade ] && /usr/local/bin/bbhn-postupgrade - # 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 - touch /etc/aredn_include/swconfig - i=0 - while true; do - uci -q get network.\@switch\[$i\] > /dev/null - local status=$? - if [ $status == 1 ] - then - break - fi - echo "config switch" >> /etc/aredn_include/swconfig - echo " option name '`uci -q get network.\@switch\[$i\].name`'" >> /etc/aredn_include/swconfig - echo " option reset '`uci -q get network.\@switch\[$i\].reset`'" >> /etc/aredn_include/swconfig - echo " option enable_vlan '`uci -q get network.\@switch\[$i\].enable_vlan`'" >> /etc/aredn_include/swconfig - echo "" >> /etc/aredn_include/swconfig - let i++ - done - - 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 - - -# 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 - - - # Save system NET LED settings - if [ ! -f /etc/aredn_include/system_netled ] - then - mkdir -p /etc/aredn_include - touch /etc/aredn_include/system_netled - i=0 - while true; do - uci -q get system.led_lan$i > /dev/null - local status=$? - if [ $status == 1 ] - then - break - fi - echo "config led 'led_lan$i'" >> /etc/aredn_include/system_netled - echo " option name '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled - echo " option sysfs '`uci -q get system.led_lan$i.sysfs`'" >> /etc/aredn_include/system_netled - echo " option trigger '`uci -q get system.led_lan$i.trigger`'" >> /etc/aredn_include/system_netled - echo " option port_mask '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled - echo "" >> /etc/aredn_include/system_netled - let i++ - done - - fi - - - # setup nvram variables [ -x /usr/local/bin/nvram-setup ] && /usr/local/bin/nvram-setup diff --git a/files/etc/uci-defaults/99_setup_aredn_include b/files/etc/uci-defaults/99_setup_aredn_include new file mode 100755 index 00000000..c3b633d4 --- /dev/null +++ b/files/etc/uci-defaults/99_setup_aredn_include @@ -0,0 +1,93 @@ +#!/bin/sh +# 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 + touch /etc/aredn_include/swconfig + i=0 + while true; do + uci -q get network.\@switch\[$i\] > /dev/null + local status=$? + if [ $status == 1 ] + then + break + fi + echo "config switch" >> /etc/aredn_include/swconfig + echo " option name '`uci -q get network.\@switch\[$i\].name`'" >> /etc/aredn_include/swconfig + echo " option reset '`uci -q get network.\@switch\[$i\].reset`'" >> /etc/aredn_include/swconfig + echo " option enable_vlan '`uci -q get network.\@switch\[$i\].enable_vlan`'" >> /etc/aredn_include/swconfig + echo "" >> /etc/aredn_include/swconfig + let i++ + done + + 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 + + +# Obtain and store the path to the wireless card so it can be used latter +if [ -z "$(uci -q get wireless.radio0.path)" ] +then + mkdir -p /etc/aredn_include + wifi detect|grep "option path"|head -n 1 > /etc/aredn_include/radio0path + wifi detect > /etc/config/wireless +else + echo " option path '$(uci -q get wireless.radio0.path)'" > /etc/aredn_include/radio0path +fi + +# Save system NET LED settings +if [ ! -f /etc/aredn_include/system_netled ] +then + mkdir -p /etc/aredn_include + touch /etc/aredn_include/system_netled + i=0 + while true; do + uci -q get system.led_lan$i > /dev/null + local status=$? + if [ $status == 1 ] + then + break + fi + echo "config led 'led_lan$i'" >> /etc/aredn_include/system_netled + echo " option name '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled + echo " option sysfs '`uci -q get system.led_lan$i.sysfs`'" >> /etc/aredn_include/system_netled + echo " option trigger '`uci -q get system.led_lan$i.trigger`'" >> /etc/aredn_include/system_netled + echo " option port_mask '`uci -q get system.led_lan$i.name`'" >> /etc/aredn_include/system_netled + echo "" >> /etc/aredn_include/system_netled + let i++ + done + +fi + +exit 0