summaryrefslogtreecommitdiffstats
path: root/package/uci/files
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-01-27 04:59:14 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-01-27 04:59:14 +0000
commit6dd7336b5a55f462ec84ba71145dc3d2ff7a8446 (patch)
treeba6c0d7dca30a32ebc37202454dc324dcb059503 /package/uci/files
parenta4466d369de83a084efa1c934712b4d6a7cd2254 (diff)
uci: allow shell scripts to override the config dir (patch by cshore)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19351 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/uci/files')
-rw-r--r--package/uci/files/lib/config/uci.sh22
1 files changed, 11 insertions, 11 deletions
diff --git a/package/uci/files/lib/config/uci.sh b/package/uci/files/lib/config/uci.sh
index 38f3097f5..851a0d779 100644
--- a/package/uci/files/lib/config/uci.sh
+++ b/package/uci/files/lib/config/uci.sh
@@ -30,7 +30,7 @@ uci_load() {
export ${NO_EXPORT:+-n} CONFIG_SECTION=
fi
- DATA="$(/sbin/uci ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE" 2>/dev/null)"
+ DATA="$(/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} ${LOAD_STATE:+-P /var/state} -S -n export "$PACKAGE" 2>/dev/null)"
RET="$?"
[ "$RET" != 0 -o -z "$DATA" ] || eval "$DATA"
unset DATA
@@ -41,9 +41,9 @@ uci_load() {
uci_set_default() {
local PACKAGE="$1"
- /sbin/uci -q show "$1" > /dev/null && return 0
- /sbin/uci import "$1"
- /sbin/uci commit "$1"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show "$1" > /dev/null && return 0
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} import "$1"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit "$1"
}
uci_revert_state() {
@@ -51,7 +51,7 @@ uci_revert_state() {
local CONFIG="$2"
local OPTION="$3"
- /sbin/uci -P /var/state revert "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state revert "$PACKAGE${CONFIG:+.$CONFIG}${OPTION:+.$OPTION}"
}
uci_set_state() {
@@ -61,7 +61,7 @@ uci_set_state() {
local VALUE="$4"
[ "$#" = 4 ] || return 0
- /sbin/uci -P /var/state set "$PACKAGE.$CONFIG${OPTION:+.$OPTION}=$VALUE"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state set "$PACKAGE.$CONFIG${OPTION:+.$OPTION}=$VALUE"
}
uci_set() {
@@ -70,7 +70,7 @@ uci_set() {
local OPTION="$3"
local VALUE="$4"
- /sbin/uci set "$PACKAGE.$CONFIG.$OPTION=$VALUE"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG.$OPTION=$VALUE"
}
uci_add() {
@@ -81,7 +81,7 @@ uci_add() {
if [ -z "$CONFIG" ]; then
export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci add "$PACKAGE" "$TYPE")"
else
- /sbin/uci set "$PACKAGE.$CONFIG=$TYPE"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG=$TYPE"
export ${NO_EXPORT:+-n} CONFIG_SECTION="$CONFIG"
fi
}
@@ -91,7 +91,7 @@ uci_rename() {
local CONFIG="$2"
local VALUE="$3"
- /sbin/uci rename "$PACKAGE.$CONFIG=$VALUE"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename "$PACKAGE.$CONFIG=$VALUE"
}
uci_remove() {
@@ -99,10 +99,10 @@ uci_remove() {
local CONFIG="$2"
local OPTION="$3"
- /sbin/uci del "$PACKAGE.$CONFIG${OPTION:+.$OPTION}"
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del "$PACKAGE.$CONFIG${OPTION:+.$OPTION}"
}
uci_commit() {
local PACKAGE="$1"
- /sbin/uci commit $PACKAGE
+ /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit $PACKAGE
}