diff --git a/openwrt/package/base-files/default/etc/functions.sh b/openwrt/package/base-files/default/etc/functions.sh index 14f5011db..c813e39a6 100755 --- a/openwrt/package/base-files/default/etc/functions.sh +++ b/openwrt/package/base-files/default/etc/functions.sh @@ -1,22 +1,8 @@ #!/bin/ash +. /etc/nvram.sh alias debug=${DEBUG:-:} -# allow env to override nvram -nvram () { - if [ -x /usr/sbin/nvram ]; then - case $1 in - get) eval "echo \${$2:-\$(command nvram get $2)}";; - *) command nvram $*;; - esac - else - case $1 in - get) eval "echo \${$2:-\${DEFAULT_$2}}";; - *);; - esac - fi -} - # valid interface? if_valid () ( ifconfig "$1" >&- 2>&- || diff --git a/openwrt/package/base-files/default/etc/init.d/S10boot b/openwrt/package/base-files/default/etc/init.d/S10boot index 37eb7b3cc..3ec41b119 100755 --- a/openwrt/package/base-files/default/etc/init.d/S10boot +++ b/openwrt/package/base-files/default/etc/init.d/S10boot @@ -1,5 +1,8 @@ #!/bin/sh -echo "S" > /proc/jffs2_bbc +. /etc/nvram.sh +if [ "$(uname -r|grep 2.4)" = "0" ];do + echo "S" > /proc/jffs2_bbc +done mkdir -p /var/run mkdir -p /var/log diff --git a/openwrt/package/base-files/default/etc/init.d/rcS b/openwrt/package/base-files/default/etc/init.d/rcS index 706585801..10079c593 100755 --- a/openwrt/package/base-files/default/etc/init.d/rcS +++ b/openwrt/package/base-files/default/etc/init.d/rcS @@ -1,4 +1,5 @@ #!/bin/sh +. /etc/nvram.sh syslog_ip=$(nvram get log_ipaddr) ipcalc -s "$syslog_ip" || syslog_ip="" syslogd -C 16 ${syslog_ip:+-L -R $syslog_ip} diff --git a/openwrt/package/base-files/default/etc/nvram.sh b/openwrt/package/base-files/default/etc/nvram.sh new file mode 100644 index 000000000..f1170ac47 --- /dev/null +++ b/openwrt/package/base-files/default/etc/nvram.sh @@ -0,0 +1,17 @@ +#!/bin/ash + +# allow env to override nvram +nvram () { + if [ -x /usr/sbin/nvram ]; then + case $1 in + get) eval "echo \${$2:-\$(command nvram get $2)}";; + *) command nvram $*;; + esac + else + case $1 in + get) eval "echo \${$2:-\${DEFAULT_$2}}";; + *);; + esac + fi +} + diff --git a/openwrt/package/base-files/default/etc/preinit b/openwrt/package/base-files/default/etc/preinit index b23f8833e..34de88c60 100755 --- a/openwrt/package/base-files/default/etc/preinit +++ b/openwrt/package/base-files/default/etc/preinit @@ -1,4 +1,5 @@ #!/bin/sh +. /etc/nvram.sh export PATH=/bin:/sbin:/usr/bin:/usr/sbin mount none /proc -t proc insmod diag diff --git a/openwrt/package/base-files/default/sbin/mount_root b/openwrt/package/base-files/default/sbin/mount_root index 29c5126ba..ae78ee488 100755 --- a/openwrt/package/base-files/default/sbin/mount_root +++ b/openwrt/package/base-files/default/sbin/mount_root @@ -1,4 +1,5 @@ #!/bin/sh +. /etc/nvram.sh if [ "$1" != "failsafe" ]; then mount | grep jffs2 >&- if [ $? = 0 ] ; then