From 8cd461d92b6903e86d4f6286c499a35b2c3e6673 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 25 Nov 2018 12:40:58 +0100 Subject: [PATCH] sysutils/nut: add listen, make arguments more flexible (#1020) (cherry picked from commit 6ca68369b96ee4a6ca14a8492ba832ebbd25333b) --- sysutils/nut/Makefile | 3 +-- .../OPNsense/Nut/forms/settings.xml | 24 +++++++++++++++---- .../mvc/app/models/OPNsense/Nut/Nut.xml | 14 +++++++---- .../service/templates/OPNsense/Nut/ups.conf | 16 +++++++++---- .../service/templates/OPNsense/Nut/upsd.conf | 7 ++++-- 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/sysutils/nut/Makefile b/sysutils/nut/Makefile index fcececcc4..bddbdb5d3 100644 --- a/sysutils/nut/Makefile +++ b/sysutils/nut/Makefile @@ -1,6 +1,5 @@ PLUGIN_NAME= nut -PLUGIN_VERSION= 1.3 -PLUGIN_REVISION= 2 +PLUGIN_VERSION= 1.4 PLUGIN_COMMENT= Network UPS Tools PLUGIN_DEPENDS= nut PLUGIN_MAINTAINER= m.muenz@gmail.com diff --git a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml index 38ce85959..f14e69270 100644 --- a/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml +++ b/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/forms/settings.xml @@ -19,6 +19,14 @@ text Set a name for your UPS. + + nut.general.listen + + + select_multiple + true + Set the addresses this service listen on. + @@ -46,7 +54,9 @@ nut.usbhid.args - text + + select_multiple + true Set extra arguments for this UPS, e.g. "port=auto". @@ -60,7 +70,9 @@ nut.apcsmart.args - text + + select_multiple + true Set extra arguments for this UPS, e.g. "port=auto". @@ -74,7 +86,9 @@ nut.blazerusb.args - text + + select_multiple + true Set extra arguments for this UPS, e.g. "port=auto". @@ -88,7 +102,9 @@ nut.blazerser.args - text + + select_multiple + true Set extra arguments for this UPS, e.g. "port=auto". diff --git a/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Nut.xml b/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Nut.xml index 1a1a91891..a5f2c4503 100644 --- a/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Nut.xml +++ b/sysutils/nut/src/opnsense/mvc/app/models/OPNsense/Nut/Nut.xml @@ -1,7 +1,7 @@ //OPNsense/Nut Network UPS Tools - 1.0.1 + 1.0.2 @@ -20,6 +20,10 @@ UPSName Y + + 127.0.0.1,::1 + Y + @@ -38,7 +42,7 @@ Y 0 - + port=auto N @@ -48,7 +52,7 @@ Y 0 - + port=auto N @@ -58,7 +62,7 @@ Y 0 - + port=auto N @@ -68,7 +72,7 @@ Y 0 - + port=auto N diff --git a/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/ups.conf b/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/ups.conf index 3b5ee9919..c7312c568 100644 --- a/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/ups.conf +++ b/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/ups.conf @@ -6,28 +6,36 @@ [{{ OPNsense.Nut.general.name }}] driver=usbhid-ups {% if helpers.exists('OPNsense.Nut.usbhid.args') and OPNsense.Nut.usbhid.args != '' %} -{{ OPNsense.Nut.usbhid.args }} +{% for args in OPNsense.Nut.usbhid.args.split(',') %} +{{ args }} +{% endfor %} {% endif %} {% endif %} {% if helpers.exists('OPNsense.Nut.apcsmart.enable') and OPNsense.Nut.apcsmart.enable == '1' %} [{{ OPNsense.Nut.general.name }}] driver=apcsmart {% if helpers.exists('OPNsense.Nut.apcsmart.args') and OPNsense.Nut.apcsmart.args != '' %} -{{ OPNsense.Nut.apcsmart.args }} +{% for args in OPNsense.Nut.apcsmart.args.split(',') %} +{{ args }} +{% endfor %} {% endif %} {% endif %} {% if helpers.exists('OPNsense.Nut.blazerusb.enable') and OPNsense.Nut.blazerusb.enable == '1' %} [{{ OPNsense.Nut.general.name }}] driver=blazer_usb {% if helpers.exists('OPNsense.Nut.blazerusb.args') and OPNsense.Nut.blazerusb.args != '' %} -{{ OPNsense.Nut.blazerusb.args }} +{% for args in OPNsense.Nut.blazerusb.args.split(',') %} +{{ args }} +{% endfor %} {% endif %} {% endif %} {% if helpers.exists('OPNsense.Nut.blazerser.enable') and OPNsense.Nut.blazerser.enable == '1' %} [{{ OPNsense.Nut.general.name }}] driver=blazer_ser {% if helpers.exists('OPNsense.Nut.blazerser.args') and OPNsense.Nut.blazerser.args != '' %} -{{ OPNsense.Nut.blazerser.args }} +{% for args in OPNsense.Nut.blazerser.args.split(',') %} +{{ args }} +{% endfor %} {% endif %} {% endif %} {% endif %} diff --git a/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/upsd.conf b/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/upsd.conf index 6cf23d5b4..47f9bf083 100644 --- a/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/upsd.conf +++ b/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/upsd.conf @@ -3,7 +3,10 @@ # {% if helpers.exists('OPNsense.Nut.general.enable') and OPNsense.Nut.general.enable == '1' %} {% if helpers.exists('OPNsense.Nut.general.mode') and OPNsense.Nut.general.mode == 'standalone' %} -LISTEN 127.0.0.1 -LISTEN ::1 +{% if helpers.exists('OPNsense.Nut.general.listen') %} +{% for listenaddress in OPNsense.Nut.general.listen.split(',') %} +LISTEN {{ listenaddress }} 3493 +{% endfor %} +{% endif %} {% endif %} {% endif %}