cleanups
authorMike Baker <mbm@openwrt.org>
Mon, 6 Mar 2006 08:25:06 +0000 (08:25 +0000)
committerMike Baker <mbm@openwrt.org>
Mon, 6 Mar 2006 08:25:06 +0000 (08:25 +0000)
SVN-Revision: 3316

openwrt/package/base-files/default/etc/init.d/S05nvram

index c0b58101c0bf7b64ffc2025b0bb85b661e78369e..45d22c95d2f7cc4469a8b89875565893c1ee8822 100755 (executable)
@@ -29,11 +29,14 @@ nvram_set() { # for the linksys fixup part
 
 # work around braindead CFE defaults in linksys routers
 boardtype=$(nvram get boardtype)
+boardnum=$(nvram get boardnum)
+product_name=$(nvram get product_name)
+
 boardflags=$(($(nvram get boardflags)))
-[ "$boardtype" = "bcm94710dev" ] && boardtype="0xdeadbeef"
 adm_switch="$(( ($boardflags & 0x80) >> 7 ))"
+
 case "$(( $boardtype ))" in
-       "$((0x708))")
+       "1800") #0x708
                if [ "$adm_switch" = 0 ]; then
                        nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
                        [ "$COMMIT" = 1 ] && {
@@ -48,7 +51,7 @@ case "$(( $boardtype ))" in
                        }
                fi
        ;;
-       "$((0x467))")
+       "1127") #0x467
                nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
                [ "$COMMIT" = 1 ] && {
                        nvram_set sdram_config 0x0062
@@ -63,13 +66,12 @@ case "$(( $boardtype ))" in
 esac
 [ "$COMMIT" = "1" ] && nvram commit
 
-
 # linksys bug; remove when not using static configuration for lan
 nvram set lan_proto="static"
 
 # hacks for wrt54g 1.x hardware
-[  "$(nvram get boardnum)"  = "42" \
--a "$(nvram get boardtype)" = "bcm94710dev" ] && {
+[  "$boardnum"  = "42" \
+-a "$boardtype" = "bcm94710dev" ] && {
        debug "### wrt54g 1.x hack ###"
        nvram set vlan1hwname="et0"
        nvram set vlan2hwname="et0"
@@ -78,8 +80,8 @@ nvram set lan_proto="static"
 }
 
 # hacks for asus wl-500g deluxe
-[  "$(nvram get boardtype)" = "bcm95365r" \
--a "$(nvram get boardnum)" = "45" ] && {
+[  "$boardnum"  = "45" \
+-a "$boardtype" = "bcm95365r" ] && {
        debug "### wl-500g deluxe hacks ###"
        nvram set vlan0hwname="et0"
        nvram set vlan1hwname="et0"
@@ -107,24 +109,24 @@ case "$(nvram get productid)" in
        *)
                # wl-500g defaults. these are placed here, because WL-HDD and WL-300g
                # might have the same nvram settings.
-               [ "$(nvram get boardnum)" = "asusX" \
-               -a "$(nvram get boardtype)" = "bcm94710dev" ] && {
+               [ "$boardnum"   = "asusX" \
+               -a "$boardtype" = "bcm94710dev" ] && {
                        nvram_default wan_device "eth1"
                }
        ;;
 esac
 
 # hacks for wap54g hardware
-[  "$(nvram get boardnum)" = "2" \
--o "$(nvram get boardnum)" = "1024" ] && {
+[  "$boardnum" = "2" \
+-o "$boardnum" = "1024" ] && {
        debug "### wap54g hack ###"
        nvram set wan_ifname="none"
 }
 
 # hacks for buffalo wla2-g54l
-[  "$(nvram get boardnum)" = "00" \
--a "$(nvram get product_name)" = "Product_name" \
--o "$(nvram get product_name)" = "WLA2-G54L" ] && {
+[  "$boardnum" = "00" \
+-a "$product_name" = "Product_name" \
+-o "$product_name" = "WLA2-G54L" ] && {
        debug "### wla2-g54l hacks ###"
        nvram set wan_ifname="none"
        nvram set lan_ifnames="vlan0"
@@ -160,4 +162,3 @@ esac
        nvram set il0macaddr=$(nvram get et0macaddr|
        awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}')
 }
-