summaryrefslogtreecommitdiff
path: root/package/uci
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-02-09 17:27:43 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-02-09 17:27:43 +0000
commite1bb6ae6be49036050cf061bf1f1441482217f2e (patch)
tree0c307778ad668bcf5b9d9e47e6a902f0d14b2c8f /package/uci
parentdd90a2cadda4f60cc3a6afd21cd867f7db05a762 (diff)
downloadmtk-20170518-e1bb6ae6be49036050cf061bf1f1441482217f2e.zip
mtk-20170518-e1bb6ae6be49036050cf061bf1f1441482217f2e.tar.gz
mtk-20170518-e1bb6ae6be49036050cf061bf1f1441482217f2e.tar.bz2
make uci_add() create anonymous sections if requested and store the new section name in a variable
SVN-Revision: 10432
Diffstat (limited to 'package/uci')
-rw-r--r--package/uci/files/uci/lib/config/uci.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/package/uci/files/uci/lib/config/uci.sh b/package/uci/files/uci/lib/config/uci.sh
index c221dcd..9428a34 100644
--- a/package/uci/files/uci/lib/config/uci.sh
+++ b/package/uci/files/uci/lib/config/uci.sh
@@ -68,7 +68,12 @@ uci_add() {
local TYPE="$2"
local CONFIG="$3"
- /sbin/uci set "$PACKAGE.$CONFIG=$TYPE"
+ if [ -z "$CONFIG" ]; then
+ export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci add "$PACKAGE" "$TYPE")"
+ else
+ /sbin/uci set "$PACKAGE.$CONFIG=$TYPE"
+ export ${NO_EXPORT:+-n} CONFIG_SECTION="$CONFIG"
+ fi
}
uci_rename() {