diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-02-03 06:48:15 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-02-03 06:48:15 +0000 |
commit | afa5da1d1bf575000d260e9abe26d47b94e3e117 (patch) | |
tree | 20d8c580675afbba4a8238eaa677d3f0fe438323 /package/base-files/files/etc | |
parent | 007000ead9f2531015d4c2c9f0b14be24d8d4aa1 (diff) |
Here comes the new UCI. Enjoy :)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10367 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/etc')
-rwxr-xr-x | package/base-files/files/etc/functions.sh | 58 | ||||
-rw-r--r-- | package/base-files/files/etc/hotplug.d/iface/00-netstate | 2 | ||||
-rw-r--r-- | package/base-files/files/etc/hotplug.d/iface/10-routes | 1 | ||||
-rwxr-xr-x | package/base-files/files/etc/init.d/boot | 2 |
4 files changed, 25 insertions, 38 deletions
diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh index ef2801512..5ad45ecdb 100755 --- a/package/base-files/files/etc/functions.sh +++ b/package/base-files/files/etc/functions.sh @@ -10,6 +10,7 @@ N=" _C=0 NO_EXPORT=1 +LOAD_STATE=1 hotplug_dev() { env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug-call net @@ -23,12 +24,21 @@ append() { eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\"" } +config_load() { + [ -n "$IPKG_INSTROOT" ] && return 0 + uci_load "$@" +} + reset_cb() { config_cb() { return 0; } option_cb() { return 0; } } reset_cb +package() { + return 0 +} + config () { local cfgtype="$1" local name="$2" @@ -84,37 +94,6 @@ config_clear() { done } -config_load() { - local cfg - local uci - local PACKAGE="$1" - - case "$PACKAGE" in - /*) cfg="$PACKAGE" - uci="" - ;; - *) cfg="$UCI_ROOT/etc/config/$PACKAGE" - uci="/tmp/.uci/${PACKAGE}" - ;; - esac - - [ -e "$cfg" ] || cfg="" - [ -e "$uci" ] || uci="" - - # no config - [ -z "$cfg" -a -z "$uci" ] && return 1 - - _C=0 - export ${NO_EXPORT:+-n} CONFIG_SECTIONS= - export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0 - export ${NO_EXPORT:+-n} CONFIG_SECTION= - - ${cfg:+. "$cfg"} - ${uci:+. "$uci"} - - ${CONFIG_SECTION:+config_cb} -} - config_get() { case "$3" in "") eval "echo \"\${CONFIG_${1}_${2}}\"";; @@ -218,8 +197,15 @@ jffs2_mark_erase() { echo -e "\xde\xad\xc0\xde" | mtd -qq write - "$1" } -uci_set_default() { - local PACKAGE="$1" - [ -e "/etc/config/$1" ] && return 0 - cat > "/etc/config/$1" -} +uci_apply_defaults() {( + cd /etc/uci-defaults || return 0 + files="$(ls)" + [ -z "$files" ] && return 0 + mkdir -p /tmp/.uci + for file in $files; do + ( . "./$(basename $file)" ) && rm -f "$file" + done + uci commit +)} + +[ -z "$IPKG_INSTROOT" ] && . /lib/config/uci.sh diff --git a/package/base-files/files/etc/hotplug.d/iface/00-netstate b/package/base-files/files/etc/hotplug.d/iface/00-netstate index 6bf621437..f215d29b5 100644 --- a/package/base-files/files/etc/hotplug.d/iface/00-netstate +++ b/package/base-files/files/etc/hotplug.d/iface/00-netstate @@ -1,3 +1,3 @@ [ ifup = "$ACTION" ] && { - uci set "/var/state/network.$INTERFACE.up=1" + uci_set_state network "$INTERFACE" up 1 } diff --git a/package/base-files/files/etc/hotplug.d/iface/10-routes b/package/base-files/files/etc/hotplug.d/iface/10-routes index 7e957f7f1..963728faf 100644 --- a/package/base-files/files/etc/hotplug.d/iface/10-routes +++ b/package/base-files/files/etc/hotplug.d/iface/10-routes @@ -63,7 +63,6 @@ case "$ACTION" in ifup) include /lib/network scan_interfaces - . /var/state/network config_foreach "add_route" route config_foreach "add_route6" route6 ;; diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index b524c39c6..0b7744746 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -36,6 +36,8 @@ start() { mkdir -p /var/log mkdir -p /var/lock mkdir -p /var/state + mkdir -p /tmp/.uci + chown 0700 /tmp/.uci touch /var/log/wtmp touch /var/log/lastlog ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf |