aboutsummaryrefslogtreecommitdiffstats
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
commit0c54a6353f893f9a3e30a74ff0bd82b7bd7355bd (patch)
tree090a9380ae99414f0161c0ce422d3cebd368e49e
parent88264737b628e6b8c57d52ead57eaf3430876c1c (diff)
downloadupstream-0c54a6353f893f9a3e30a74ff0bd82b7bd7355bd.tar.gz
upstream-0c54a6353f893f9a3e30a74ff0bd82b7bd7355bd.tar.bz2
upstream-0c54a6353f893f9a3e30a74ff0bd82b7bd7355bd.zip
make uci_add() create anonymous sections if requested and store the new section name in a variable
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10432 3c298f89-4303-0410-b956-a3cf2f4a3e73
-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 c221dcdc6b..9428a349dc 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() {