uci: add missing 'option' support to uci_rename()
authorTony Ambardar <itugrok@yahoo.com>
Tue, 25 Apr 2017 09:16:56 +0000 (02:16 -0700)
committerJo-Philipp Wich <jo@mein.io>
Tue, 2 Jan 2018 16:22:19 +0000 (17:22 +0100)
When using the uci.sh wrapper, allow parameters to match those supported
by the uci binary i.e. "uci rename <config>.<section>[.<option>]=<name>".

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
package/system/uci/files/lib/config/uci.sh

index 50891a6..78ec277 100644 (file)
@@ -118,9 +118,10 @@ uci_add() {
 uci_rename() {
        local PACKAGE="$1"
        local CONFIG="$2"
-       local VALUE="$3"
+       local OPTION="$3"
+       local VALUE="$4"
 
-       /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename "$PACKAGE.$CONFIG=$VALUE"
+       /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} rename "$PACKAGE.$CONFIG${VALUE:+.$OPTION}=${VALUE:-$OPTION}"
 }
 
 uci_remove() {