mirror of https://github.com/hak5/openwrt.git
move uci_load into config_load so that changes can be applied via uci without commiting
SVN-Revision: 7927lede-17.01
parent
b1d970fd1d
commit
57da2d5713
|
@ -85,19 +85,32 @@ config_clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
config_load() {
|
config_load() {
|
||||||
local file
|
local cfg
|
||||||
case "$1" in
|
local uci
|
||||||
/*) file="$1";;
|
local PACKAGE="$1"
|
||||||
*) file="$UCI_ROOT/etc/config/$1";;
|
|
||||||
|
case "$PACKAGE" in
|
||||||
|
/*) cfg="$PACKAGE"
|
||||||
|
uci=""
|
||||||
|
;;
|
||||||
|
*) cfg="$UCI_ROOT/etc/config/$PACKAGE"
|
||||||
|
uci="/tmp/.uci/${PACKAGE}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
[ -e "$cfg" ] || cfg=""
|
||||||
|
[ -e "$uci" ] || uci=""
|
||||||
|
|
||||||
|
# no config
|
||||||
|
[ -z "$cfg" -a -z "$uci" ] && return 1
|
||||||
|
|
||||||
_C=0
|
_C=0
|
||||||
export ${NO_EXPORT:+-n} CONFIG_SECTIONS=
|
export ${NO_EXPORT:+-n} CONFIG_SECTIONS=
|
||||||
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0
|
export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=0
|
||||||
export ${NO_EXPORT:+-n} CONFIG_SECTION=
|
export ${NO_EXPORT:+-n} CONFIG_SECTION=
|
||||||
|
|
||||||
[ -e "$file" ] && {
|
${cfg:+. "$cfg"}
|
||||||
. $file
|
${uci:+. "$uci"}
|
||||||
} || return 1
|
|
||||||
|
|
||||||
${CONFIG_SECTION:+config_cb}
|
${CONFIG_SECTION:+config_cb}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,7 @@
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
uci_load() {
|
uci_load() {
|
||||||
local PACKAGE="$1"
|
config_load "$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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uci_apply_defaults() {(
|
uci_apply_defaults() {(
|
||||||
|
|
Loading…
Reference in New Issue