nut: Fix additional (other) variable handling
authorDaniel F. Dickinson <cshored@thecshore.com>
Thu, 20 Dec 2018 06:55:15 +0000 (01:55 -0500)
committerDaniel F. Dickinson <cshored@thecshore.com>
Fri, 21 Dec 2018 04:24:00 +0000 (23:24 -0500)
There was a cut & paste error in the handling of 'other'
variables (i.e. driver variables not specifically known
to the package but which some users may require to be add).
There was also a logic error from not switching sufficient
after cut & paste.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
net/nut/files/nut-server.init

index f40b7bfb70df4a0a37318c220868a4f24b9a3fcb..2cdeb96cf04f5e13f279e8b3e6b1b08439978a8a 100755 (executable)
@@ -192,16 +192,16 @@ build_driver_config() {
                local othervarflag="$2"
 
                if [ "$othervarflag" = "otherflag" ]; then
-                       config_get_bool otherval "${othervarflag}_${overtype}" value
-                       [ "$otherval" = "1" ] && echo "${othervarflag}_${othervar}" >>"$UPS_C"
+                       config_get_bool otherval "${othervarflag}_${othervar}" value
+                       [ "$otherval" = "1" ] && echo "${othervar}" >>"$UPS_C"
                else
-                       config_get otherval "${othervarflag}_${overtype}" value
-                       [ -n "$otherval" ] && echo "${othervarflag}_${othervar} = $otherval" >>"$UPS_C"
+                       config_get otherval "${othervarflag}_${othervar}" value
+                       [ -n "$otherval" ] && echo "${othervar} = $otherval" >>"$UPS_C"
                fi
        }
 
-       config_list_foreach "$cfg" default other other
-       config_list_foreach "$cfg" default other otherflag
+       config_list_foreach "$cfg" other other
+       config_list_foreach "$cfg" other otherflag
        echo "" >>$UPS_C
        havedriver=1
 }