add extra safety for linksys nvram fixup (should fix #56, though i haven't been able...
authorFelix Fietkau <nbd@openwrt.org>
Tue, 15 Nov 2005 21:26:39 +0000 (21:26 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 15 Nov 2005 21:26:39 +0000 (21:26 +0000)
SVN-Revision: 2507

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

index f5ffc13dfac482d6f9431238367f09dcb341be1b..debf839b0298d8f5e7576f4fcae55fcdaa10957d 100755 (executable)
@@ -21,9 +21,9 @@ nvram_default() {
 }
 
 nvram_set() { # for the linksys fixup part
-       [ "$(nvram get "$1")" = "$2" ] || {
+       [ "$(nvram get "$1")" = "$2" -a "$2" != "" ] || {
                COMMIT=1
-               nvram set "$1=$2"
+               /usr/sbin/nvram set "$1=$2"
        }
 }
 
@@ -35,7 +35,7 @@ adm_switch="$(( ($boardflags & 0x80) >> 7 ))"
 case "$(( $boardtype ))" in
        "$((0x708))")
                if [ "$adm_switch" = 0 ]; then
-                       nvram_set sdram_init "$(printf 0x%04x $(( $(nvram get sdram_init) | 0x0100 )))"
+                       nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
                        [ "$COMMIT" = 1 ] && {
                                nvram_set sdram_config 0x0062
                                nvram_set clkfreq 216
@@ -49,7 +49,7 @@ case "$(( $boardtype ))" in
                fi
        ;;
        "$((0x467))")
-               nvram_set sdram_init "$(printf 0x%04x $(( $(nvram get sdram_init) | 0x0100 )))"
+               nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))"
                [ "$COMMIT" = 1 ] && {
                        nvram_set sdram_config 0x0062
                        nvram_set sdram_ncdl 0x0