summaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc
diff options
context:
space:
mode:
authormbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-07-11 20:39:28 +0000
committermbm <mbm@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-07-11 20:39:28 +0000
commitd3ba75415e85880b936cfee6ba8b3746a65e0463 (patch)
treee8dbc41403a9da01b1bc95727b69442ebdb8aaa5 /package/base-files/files/etc
parentb549f7c5f45523bf03f6f46ed1cb509c438f4ae4 (diff)
move uci_load into config_load so that changes can be applied via uci without commiting
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7927 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/etc')
-rwxr-xr-xpackage/base-files/files/etc/functions.sh29
1 files changed, 21 insertions, 8 deletions
diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh
index 8d1117163..4446931d5 100755
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -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}
}