make uci_add() create anonymous sections if requested and store the new section name in a variable

SVN-Revision: 10432
owl
Felix Fietkau 2008-02-09 17:27:43 +00:00
parent dd90a2cadd
commit e1bb6ae6be
1 changed files with 6 additions and 1 deletions

View File

@ -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() {