move uci_load into config_load so that changes can be applied via uci without commiting
[openwrt/openwrt.git] / package / base-files / files / etc / functions.sh
index 8d1117163d35401bca4da054735e3d8cd2f1deb1..4446931d59ceeec8c72cef07f88dc0861a4280a6 100755 (executable)
@@ -85,19 +85,32 @@ config_clear() {
 }
 
 config_load() {
-       local file
-       case "$1" in
-               /*) file="$1";;
-               *) file="$UCI_ROOT/etc/config/$1";;
+       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=
-       
-       [ -e "$file" ] && {
-               . $file
-       } || return 1
+
+       ${cfg:+. "$cfg"}
+       ${uci:+. "$uci"}
        
        ${CONFIG_SECTION:+config_cb}
 }