aboutsummaryrefslogtreecommitdiffstats
path: root/package/uci/files/lib
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-01-27 04:59:14 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-01-27 04:59:14 +0000
commit4e7fded1c43fd7396e9c442eaf30454fd2bc736c (patch)
treebf08821cdcba490bb0c277ffec9eb38b6ee87e42 /package/uci/files/lib
parent8775d98c193c50059c28364340035af8f9d21472 (diff)
downloadupstream-4e7fded1c43fd7396e9c442eaf30454fd2bc736c.tar.gz
upstream-4e7fded1c43fd7396e9c442eaf30454fd2bc736c.tar.bz2
upstream-4e7fded1c43fd7396e9c442eaf30454fd2bc736c.zip
uci: allow shell scripts to override the config dir (patch by cshore)
SVN-Revision: 19351
Diffstat (limited to 'package/uci/files/lib')
-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 38f3097f5b..851a0d779b 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
}