make uci_add() create anonymous sections if requested and store the new section name...
authorFelix Fietkau <nbd@openwrt.org>
Sat, 9 Feb 2008 17:27:43 +0000 (17:27 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 9 Feb 2008 17:27:43 +0000 (17:27 +0000)
SVN-Revision: 10432

package/uci/files/uci/lib/config/uci.sh

index c221dcdc6bc97d80427f4763b89f790c98a91f7c..9428a349dccf9a4cde37467360cd6424971ac814 100644 (file)
@@ -68,7 +68,12 @@ uci_add() {
        local TYPE="$2"
        local CONFIG="$3"
 
        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() {
 }
 
 uci_rename() {