From 97c7ef6c4d0717e3c5b49c9a311fe14129b66a1b Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Thu, 20 Dec 2018 01:44:40 -0500 Subject: [PATCH 1/6] nut: alphabetize driver options There are a lot of options; to make development easier alphabetize them. Signed-off-by: Daniel F. Dickinson --- net/nut/files/nut-server.init | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/net/nut/files/nut-server.init b/net/nut/files/nut-server.init index 045b29d48..8f1299f8b 100755 --- a/net/nut/files/nut-server.init +++ b/net/nut/files/nut-server.init @@ -145,37 +145,37 @@ build_driver_config() { echo "[$cfg]" >>"$UPS_C" - get_write_driver_config "$cfg" driver "usbhid-ups" - get_write_driver_config "$cfg" port "auto" - get_write_driver_config "$cfg" sdorder - get_write_driver_config "$cfg" desc - get_write_driver_config "$cfg" nolock 0 1 - get_write_driver_config "$cfg" ignorelb 0 1 - get_write_driver_config "$cfg" mfr - get_write_driver_config "$cfg" model - get_write_driver_config "$cfg" serial - get_write_driver_config "$cfg" sdtime - get_write_driver_config "$cfg" offdelay - get_write_driver_config "$cfg" ondelay - get_write_driver_config "$cfg" pollfreq - get_write_driver_config "$cfg" vendor - get_write_driver_config "$cfg" product get_write_driver_config "$cfg" bus + get_write_driver_config "$cfg" community + get_write_driver_config "$cfg" desc + get_write_driver_config "$cfg" driver "usbhid-ups" + get_write_driver_config "$cfg" ignorelb 0 1 get_write_driver_config "$cfg" interruptonly 0 1 get_write_driver_config "$cfg" interruptsize get_write_driver_config "$cfg" maxreport - get_write_driver_config "$cfg" vendorid + get_write_driver_config "$cfg" maxstartdelay + get_write_driver_config "$cfg" mfr + get_write_driver_config "$cfg" model + get_write_driver_config "$cfg" nolock 0 1 + get_write_driver_config "$cfg" notransferoids 0 1 + get_write_driver_config "$cfg" offdelay + get_write_driver_config "$cfg" ondelay + get_write_driver_config "$cfg" other + get_write_driver_config "$cfg" otherflag + get_write_driver_config "$cfg" pollfreq + get_write_driver_config "$cfg" port "auto" + get_write_driver_config "$cfg" product get_write_driver_config "$cfg" productid - get_write_driver_config "$cfg" community + get_write_driver_config "$cfg" retrydelay + get_write_driver_config "$cfg" sdorder + get_write_driver_config "$cfg" sdtime + get_write_driver_config "$cfg" serial get_write_driver_config "$cfg" snmp_version get_write_driver_config "$cfg" snmp_retries get_write_driver_config "$cfg" snmp_timeout - get_write_driver_config "$cfg" notransferoids 0 1 - get_write_driver_config "$cfg" maxstartdelay - get_write_driver_config "$cfg" retrydelay get_write_driver_config "$cfg" synchronous - get_write_driver_config "$cfg" other - get_write_driver_config "$cfg" otherflag + get_write_driver_config "$cfg" vendor + get_write_driver_config "$cfg" vendorid defoverride() { local overvar="$1" From d04f2580b14d88413c22f1143f8da40bcc5f06d6 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Thu, 20 Dec 2018 01:52:27 -0500 Subject: [PATCH 2/6] nut: Remove extraneous config reads Handling of driver variable defaults, overrides, and additional (other) variables changed and left behind some extraneous config reads (config_get and config_list_foreach). Remove those. Signed-off-by: Daniel F. Dickinson --- net/nut/files/nut-server.init | 4 ---- 1 file changed, 4 deletions(-) diff --git a/net/nut/files/nut-server.init b/net/nut/files/nut-server.init index 8f1299f8b..f40b7bfb7 100755 --- a/net/nut/files/nut-server.init +++ b/net/nut/files/nut-server.init @@ -160,8 +160,6 @@ build_driver_config() { get_write_driver_config "$cfg" notransferoids 0 1 get_write_driver_config "$cfg" offdelay get_write_driver_config "$cfg" ondelay - get_write_driver_config "$cfg" other - get_write_driver_config "$cfg" otherflag get_write_driver_config "$cfg" pollfreq get_write_driver_config "$cfg" port "auto" get_write_driver_config "$cfg" product @@ -202,8 +200,6 @@ build_driver_config() { fi } - config_list_foreach "$cfg" override defoverride override - config_list_foreach "$cfg" default defoverride default config_list_foreach "$cfg" default other other config_list_foreach "$cfg" default other otherflag echo "" >>$UPS_C From 23c4235554654c590b58fa4829cb87222f8ad058 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Thu, 20 Dec 2018 01:55:15 -0500 Subject: [PATCH 3/6] nut: Fix additional (other) variable handling 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 --- net/nut/files/nut-server.init | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/nut/files/nut-server.init b/net/nut/files/nut-server.init index f40b7bfb7..2cdeb96cf 100755 --- a/net/nut/files/nut-server.init +++ b/net/nut/files/nut-server.init @@ -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 } From f916a7e0ebf413a5d60c9d271766121d4ddb0ffd Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Sat, 22 Dec 2018 21:47:34 -0500 Subject: [PATCH 4/6] nut: Update server config comment 'docs' Update the commented out settings in /etc/config/nut_server that shows the available sections with their default settings. Signed-off-by: Daniel F. Dickinson --- net/nut/files/nut_server | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/nut/files/nut_server b/net/nut/files/nut_server index 464d56303..6449203a4 100644 --- a/net/nut/files/nut_server +++ b/net/nut/files/nut_server @@ -1,8 +1,9 @@ +#config driver_global 'driver_global' +# option user nut + #config driver 'upsname' # option driver usbhid-ups # option port auto -# option other other-value -# option runas root #config user # option username upsuser From 2d87aa40c84799c2ccf6f8b5593a390670aaff06 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Sun, 23 Dec 2018 00:14:53 -0500 Subject: [PATCH 5/6] nut: really run upsd as non-root One local removal was missed in last push of this fix, so in certain circumstances upsd would run as root even when it shouldn't. Fixes f48b060fa752 ("nut: Fix upsd runs as root") Closes: #6697 (properly) Signed-off-by: Daniel F. Dickinson --- net/nut/files/nut-server.init | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/nut/files/nut-server.init b/net/nut/files/nut-server.init index 2cdeb96cf..a1df01645 100755 --- a/net/nut/files/nut-server.init +++ b/net/nut/files/nut-server.init @@ -225,7 +225,6 @@ build_global_driver_config() { } build_config() { - local RUNAS=nut local STATEPATH=/var/run/nut mkdir -m 0755 -p "$(dirname "$UPS_C")" @@ -281,7 +280,7 @@ start_driver_instance() { } start_server_instance() { - local RUNAS + local RUNAS=nut build_config [ "$haveserver" != 1 ] && return From 89effa4a8479d1151d088f26efee4947ffcf0f23 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Sat, 22 Dec 2018 22:14:31 -0500 Subject: [PATCH 6/6] nut: Bump PKG_RELEASE Signed-off-by: Daniel F. Dickinson --- net/nut/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/nut/Makefile b/net/nut/Makefile index 7405ad20b..985feae5d 100644 --- a/net/nut/Makefile +++ b/net/nut/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nut PKG_VERSION:=2.7.4 -PKG_RELEASE:=12 +PKG_RELEASE:=13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/