From d3ba75415e85880b936cfee6ba8b3746a65e0463 Mon Sep 17 00:00:00 2001 From: mbm Date: Wed, 11 Jul 2007 20:39:28 +0000 Subject: [PATCH] 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 --- package/base-files/files/etc/functions.sh | 29 ++++++++++++++++------ package/base-files/files/lib/config/uci.sh | 8 +----- 2 files changed, 22 insertions(+), 15 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} } diff --git a/package/base-files/files/lib/config/uci.sh b/package/base-files/files/lib/config/uci.sh index a53938835..71f20488c 100644 --- a/package/base-files/files/lib/config/uci.sh +++ b/package/base-files/files/lib/config/uci.sh @@ -19,13 +19,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA uci_load() { - local PACKAGE="$1" - config_load "$PACKAGE" - local PACKAGE_BASE="$(basename "$PACKAGE")" - [ -f "/tmp/.uci/${PACKAGE_BASE}" ] && { - . "/tmp/.uci/${PACKAGE_BASE}" 2>/dev/null >/dev/null - config_cb - } + config_load "$1" } uci_apply_defaults() {( -- 2.20.1