aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc/functions.sh
diff options
context:
space:
mode:
authorMike Baker <mbm@openwrt.org>2007-07-11 20:39:28 +0000
committerMike Baker <mbm@openwrt.org>2007-07-11 20:39:28 +0000
commit57da2d5713a625afe97498ee0668b9404d1ce313 (patch)
tree52d7e0c5d19bdc6e6a480813d445243f201d2f44 /package/base-files/files/etc/functions.sh
parentb1d970fd1d76068a27c8fd33b8df224c360a1c4c (diff)
downloadupstream-57da2d5713a625afe97498ee0668b9404d1ce313.tar.gz
upstream-57da2d5713a625afe97498ee0668b9404d1ce313.tar.bz2
upstream-57da2d5713a625afe97498ee0668b9404d1ce313.zip
move uci_load into config_load so that changes can be applied via uci without commiting
SVN-Revision: 7927
Diffstat (limited to 'package/base-files/files/etc/functions.sh')
-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 8d1117163d..4446931d59 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}
}