nut: Fix extra diver params config

Extra parameters for the UPS driver were not being handled correctly.
Fix that (was wrong variable name).

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
Daniel F. Dickinson
2019-08-27 00:49:46 -04:00
parent 77519cd204
commit ef0bd01409
+8 -8
View File
@@ -181,6 +181,7 @@ build_driver_config() {
local overvar="$1" local overvar="$1"
local defover="$2" local defover="$2"
local overtype="$(echo "$overvar" | tr '.' '_')" local overtype="$(echo "$overvar" | tr '.' '_')"
local overval
config_get overval "${defover}_${overtype}" value config_get overval "${defover}_${overtype}" value
[ -n "$overval" ] && echo "${defover}.${overvar} = $overval" >>"$UPS_C" [ -n "$overval" ] && echo "${defover}.${overvar} = $overval" >>"$UPS_C"
@@ -192,20 +193,19 @@ build_driver_config() {
other() { other() {
local othervar="$1" local othervar="$1"
local othervarflag="$2" local othervarflag="$2"
local otherval
if [ "$othervarflag" = "otherflag" ]; then if [ "$othervarflag" = "otherflag" ]; then
config_get_bool otherval "${othervarflag}_${overtype}" value config_get_bool otherval "${othervarflag}_${othervar}" value
[ "$otherval" = "1" ] && echo "${othervarflag}_${othervar}" >>"$UPS_C" [ "$otherval" = "1" ] && echo "${othervar}" >>"$UPS_C"
else else
config_get otherval "${othervarflag}_${overtype}" value config_get otherval "${othervarflag}_${othervar}" value
[ -n "$otherval" ] && echo "${othervarflag}_${othervar} = $otherval" >>"$UPS_C" [ -n "$otherval" ] && echo "${othervar} = $otherval" >>"$UPS_C"
fi fi
} }
config_list_foreach "$cfg" override defoverride override config_list_foreach "$cfg" other other
config_list_foreach "$cfg" default defoverride default config_list_foreach "$cfg" other otherflag
config_list_foreach "$cfg" default other other
config_list_foreach "$cfg" default other otherflag
echo "" >>$UPS_C echo "" >>$UPS_C
havedriver=1 havedriver=1
} }