Compare commits

..

37 commits

Author SHA1 Message Date
Orion Poplawski
98284f631b Add missing || : to preinstall scriptlet (rhbz#241964) 2025-12-05 18:34:11 -07:00
Michal Hlavinka
77706a32be based on PR#18 by Orion Poplawski
Build NUT-Monitor and ship in separate nut-monitor package (rhbz#2359149)
Move UPS drivers into /usr/libexec/nut
2025-09-30 12:11:02 +02:00
Python Maint
069b76a3a8 Rebuilt for Python 3.14.0rc3 bytecode 2025-09-19 12:33:37 +02:00
Python Maint
7164fc2d6d Rebuilt for Python 3.14.0rc2 bytecode 2025-08-15 13:02:57 +02:00
Michal Hlavinka
4870df85c6 updated to 2.8.4 (#2387244) 2025-08-14 12:13:59 +02:00
Fedora Release Engineering
cc9daebf1e Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 23:02:13 +00:00
Python Maint
38f34fb51d Rebuilt for Python 3.14 2025-06-02 19:58:22 +02:00
Michal Hlavinka
1f502ae93a rename rhino to nutdrv_rhino to prevent file conflict (rhbz#2367057) 2025-05-21 13:43:14 +02:00
Michal Hlavinka
9867e18241 add needed buildrequire jq 2025-04-29 17:37:37 +02:00
Michal Hlavinka
760ad72a05 updated to 2.8.3 (#2352734) 2025-04-29 16:46:04 +02:00
Zbigniew Jędrzejewski-Szmek
91e5a19370 Add sysusers.d config file to allow rpm to create users/groups automatically
See https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers.

-cgi requires -client, so it doesn't need it's copy of the file.

setup Provides group(dialout) and group(tty), but let's add the Requires
for clarity.
2025-02-11 16:33:00 +01:00
Michal Hlavinka
ce21c14155 add back git snapshot part of release number 2025-01-31 21:00:34 +01:00
Michal Hlavinka
7d3c0ad65d fix ftbfs, make it build with unified bin/sbin
fix ftbfs, make it build with unified bin/sbin
fix ftbfs, make it build with unified bin/sbin
fix ftbfs, make it build with unified bin/sbin
fix ftbfs, make it build with unified bin/sbin
2025-01-29 00:09:31 +01:00
Fedora Release Engineering
b278271309 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 20:31:55 +00:00
Orion Poplawski
3cb725a9a6 Add BR systemd-devel to enable systemd notification support 2024-11-15 16:08:05 -07:00
Fedora Release Engineering
02a191e840 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 19:52:32 +00:00
Michal Hlavinka
810e8f234e fix python FTBFS, uses git snapshot as of 20240703 with PR 2505 2024-07-03 12:59:09 +02:00
Python Maint
59f9744317 Rebuilt for Python 3.13 2024-06-07 08:33:13 +02:00
Michal Hlavinka
ada5bd73a7 updated to 2.8.2(2272586) 2024-04-03 11:56:12 +02:00
Fedora Release Engineering
17e960e140 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 09:32:03 +00:00
Fedora Release Engineering
03a2bff29b Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 10:02:08 +00:00
Michal Hlavinka
9b811d0688 fix gpio check conditions 2023-12-06 12:29:26 +01:00
Orion Poplawski
0089d11277 Re-add nut.target to nut-client (bz#2156504) 2023-11-30 11:52:01 -07:00
Michal Hlavinka
f74346c47d libgpiod v2 is not compatible, disable for now 2023-11-02 11:55:02 +01:00
Michal Hlavinka
182c96a020 updated to 2.8.1(2247337) 2023-11-01 22:31:34 +01:00
Michal Hlavinka
f9d1f583d7 spec cleanup, based on PR#14 by Orion Poplawski 2023-10-10 00:11:39 +02:00
Fedora Release Engineering
2572132723 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 17:01:05 +00:00
Orion Poplawski
d4f6d893fc Drop BR on /usr/bin/pathfix.py 2023-06-14 20:56:01 -06:00
Python Maint
ea13be436a Rebuilt for Python 3.12 2023-06-13 20:23:11 +02:00
Michal Hlavinka
d7132ee907 use new patch macro format, with epel compatibility 2023-05-03 12:26:49 +02:00
Michal Hlavinka
64fdb72282 update license tag format (SPDX migration) for https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1 2023-04-26 10:57:21 +02:00
Michal Hlavinka
dc7efebac0 add nut-xml to nut recommends (#2151810) 2023-02-14 22:19:17 +01:00
Fedora Release Engineering
aad68762c3 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 21:54:34 +00:00
Michal Hlavinka
8debbe8226 move upslog to nut-client, some small spec file changes (#2156504) 2023-01-04 13:12:09 +01:00
Michal Hlavinka
4daa893965 use https for urls 2022-12-06 22:31:17 +01:00
Charles R. Anderson
0a29e563e3 Fix STATEPATH/PIDPATH/ALTPIDPATH directory creation and ownership
use piddir for specifying restart_flag location
use piddir for specifying configure --with-statepath/pidpath/altpidpath
add nut-2.8.0-piddir-owner.patch for upstream tmpfiles config creation to not append /nut and always use owner root
update nut-2.6.3-tmpfiles.patch to use correct tmpfiles config file name
remove unused downstream tmpfiles source and code
2022-12-03 12:24:08 -05:00
Florian Weimer
6db1d50203 Port configure script to C99
Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
2022-11-27 22:18:05 +01:00
20 changed files with 380 additions and 1444 deletions

5
.gitignore vendored
View file

@ -10,3 +10,8 @@ nut-2.4.3.tar.gz
/nut-2.7.3.tar.gz
/nut-2.7.4.tar.gz
/nut-2.8.0.tar.gz
/nut-2.8.1.tar.gz
/nut-2.8.2.tar.gz
/nut-2.8.2.1.tar.gz
/nut-2.8.3.tar.gz
/nut-2.8.4.tar.gz

333
504.patch
View file

@ -1,333 +0,0 @@
From da1f5aa699f54e0f6977ab64a3bc2f90a51c3104 Mon Sep 17 00:00:00 2001
From: Arjen de Korte <build+lede@de-korte.org>
Date: Mon, 27 Nov 2017 21:10:13 +0100
Subject: [PATCH 1/7] Add support for openssl-1.1.0
---
clients/upsclient.c | 4 ++++
m4/nut_check_libopenssl.m4 | 5 +++--
server/netssl.c | 4 ++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/clients/upsclient.c b/clients/upsclient.c
index b90587b00..fc5e7523c 100644
--- a/clients/upsclient.c
+++ b/clients/upsclient.c
@@ -316,7 +316,11 @@ int upscli_init(int certverify, const char *certpath,
#ifdef WITH_OPENSSL
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
+#else
+ OPENSSL_init_ssl(0, NULL);
+#endif
SSL_load_error_strings();
ssl_method = TLSv1_client_method();
diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4
index 1b875077b..5f29f4a38 100644
--- a/m4/nut_check_libopenssl.m4
+++ b/m4/nut_check_libopenssl.m4
@@ -57,8 +57,9 @@ if test -z "${nut_have_libopenssl_seen}"; then
AC_MSG_RESULT([${LIBS}])
dnl check if openssl is usable
- AC_CHECK_HEADERS(openssl/ssl.h, [nut_have_openssl=yes], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT])
- AC_CHECK_FUNCS(SSL_library_init, [], [nut_have_openssl=no])
+ AC_CHECK_FUNCS(OPENSSL_init_ssl, [nut_have_openssl=yes], [nut_have_openssl=no])
+ AC_CHECK_FUNCS(SSL_library_init, [nut_have_openssl=yes], [])
+ AC_CHECK_HEADERS(openssl/ssl.h, [], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT])
if test "${nut_have_openssl}" = "yes"; then
nut_with_ssl="yes"
diff --git a/server/netssl.c b/server/netssl.c
index c2f409899..0f9a70acf 100644
--- a/server/netssl.c
+++ b/server/netssl.c
@@ -388,7 +388,11 @@ void ssl_init(void)
#ifdef WITH_OPENSSL
SSL_load_error_strings();
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
+#else
+ OPENSSL_init_ssl(0, NULL);
+#endif
if ((ssl_method = TLSv1_server_method()) == NULL) {
ssl_debug();
From b15656efb2575647ca0e0b6439b6380373767b8f Mon Sep 17 00:00:00 2001
From: Arjen de Korte <build+lede@de-korte.org>
Date: Tue, 28 Nov 2017 20:00:52 +0100
Subject: [PATCH 2/7] Allow TLSv1 and higher (not just TLSv1)
---
clients/upsclient.c | 30 +++++++++++++++++-------------
server/netssl.c | 26 +++++++++++++++-----------
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/clients/upsclient.c b/clients/upsclient.c
index fc5e7523c..bd951e854 100644
--- a/clients/upsclient.c
+++ b/clients/upsclient.c
@@ -299,11 +299,6 @@ int upscli_init(int certverify, const char *certpath,
{
#ifdef WITH_OPENSSL
int ret, ssl_mode = SSL_VERIFY_NONE;
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
- const SSL_METHOD *ssl_method;
-#else
- SSL_METHOD *ssl_method;
-#endif
#elif defined(WITH_NSS) /* WITH_OPENSSL */
SECStatus status;
#endif /* WITH_OPENSSL | WITH_NSS */
@@ -315,26 +310,35 @@ int upscli_init(int certverify, const char *certpath,
}
#ifdef WITH_OPENSSL
+
+ SSL_load_error_strings();
#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
+
+ ssl_ctx = SSL_CTX_new(SSLv23_client_method());
#else
OPENSSL_init_ssl(0, NULL);
-#endif
- SSL_load_error_strings();
- ssl_method = TLSv1_client_method();
-
- if (!ssl_method) {
- return 0;
- }
+ ssl_ctx = SSL_CTX_new(TLS_client_method());
+#endif
- ssl_ctx = SSL_CTX_new(ssl_method);
if (!ssl_ctx) {
upslogx(LOG_ERR, "Can not initialize SSL context");
return -1;
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ /* set minimum protocol TLSv1 */
+ SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
+#else
+ ret = SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_VERSION);
+ if (ret != 1) {
+ upslogx(LOG_ERR, "Can not set minimum protocol to TLSv1");
+ return -1;
+ }
+#endif
+
if (!certpath) {
if (certverify == 1) {
upslogx(LOG_ERR, "Can not verify certificate if any is specified");
diff --git a/server/netssl.c b/server/netssl.c
index 0f9a70acf..98680d25e 100644
--- a/server/netssl.c
+++ b/server/netssl.c
@@ -371,13 +371,7 @@ void ssl_init(void)
{
#ifdef WITH_NSS
SECStatus status;
-#elif defined(WITH_OPENSSL)
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
- const SSL_METHOD *ssl_method;
-#else
- SSL_METHOD *ssl_method;
-#endif
-#endif /* WITH_NSS|WITH_OPENSSL */
+#endif /* WITH_NSS */
if (!certfile) {
return;
@@ -388,21 +382,31 @@ void ssl_init(void)
#ifdef WITH_OPENSSL
SSL_load_error_strings();
+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
+
+ ssl_ctx = SSL_CTX_new(SSLv23_server_method());
#else
OPENSSL_init_ssl(0, NULL);
+
+ ssl_ctx = SSL_CTX_new(TLS_server_method());
#endif
- if ((ssl_method = TLSv1_server_method()) == NULL) {
+ if (!ssl_ctx) {
ssl_debug();
- fatalx(EXIT_FAILURE, "TLSv1_server_method failed");
+ fatalx(EXIT_FAILURE, "SSL_CTX_new failed");
}
- if ((ssl_ctx = SSL_CTX_new(ssl_method)) == NULL) {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ /* set minimum protocol TLSv1 */
+ SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
+#else
+ if (SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_VERSION) != 1) {
ssl_debug();
- fatalx(EXIT_FAILURE, "SSL_CTX_new failed");
+ fatalx(EXIT_FAILURE, "SSL_CTX_set_min_proto_version(TLS1_VERSION)");
}
+#endif
if (SSL_CTX_use_certificate_chain_file(ssl_ctx, certfile) != 1) {
ssl_debug();
From 5a8308aef9884017754fb70620c8ded34fa44290 Mon Sep 17 00:00:00 2001
From: Arjen de Korte <build+lede@de-korte.org>
Date: Tue, 28 Nov 2017 22:01:41 +0100
Subject: [PATCH 3/7] Fix check for empty string
---
clients/upssched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clients/upssched.c b/clients/upssched.c
index 97b3ed42d..3fdf118ed 100644
--- a/clients/upssched.c
+++ b/clients/upssched.c
@@ -794,7 +794,7 @@ static void parse_at(const char *ntype, const char *un, const char *cmd,
}
if (!strcmp(cmd, "EXECUTE")) {
- if (ca1 == '\0') {
+ if (ca1[0] == '\0') {
upslogx(LOG_ERR, "Empty EXECUTE command argument");
return;
}
From 5ecfb0ffe3d89a5116dd287ff2c3f60de67ecbb9 Mon Sep 17 00:00:00 2001
From: Arjen de Korte <build+github@de-korte.org>
Date: Fri, 1 Dec 2017 12:24:00 +0100
Subject: [PATCH 4/7] Report TLS handshake in debug mode
---
clients/upsclient.c | 2 +-
server/netssl.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/clients/upsclient.c b/clients/upsclient.c
index bd951e854..b7dd8f424 100644
--- a/clients/upsclient.c
+++ b/clients/upsclient.c
@@ -745,7 +745,7 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert)
switch(res)
{
case 1:
- upsdebugx(3, "SSL connected");
+ upsdebugx(3, "SSL connected (%s)", SSL_get_version(ups->ssl));
break;
case 0:
upslog_with_errno(1, "SSL_connect do not accept handshake.");
diff --git a/server/netssl.c b/server/netssl.c
index 98680d25e..6ae13e8d3 100644
--- a/server/netssl.c
+++ b/server/netssl.c
@@ -275,7 +275,7 @@ void net_starttls(nut_ctype_t *client, int numarg, const char **arg)
{
case 1:
client->ssl_connected = 1;
- upsdebugx(3, "SSL connected");
+ upsdebugx(3, "SSL connected (%s)", SSL_get_version(client->ssl));
break;
case 0:
From ab0c8b41c0530d3706e4997257939026cfd29ccc Mon Sep 17 00:00:00 2001
From: Arjen de Korte <build+github@de-korte.org>
Date: Sun, 24 Feb 2019 18:31:21 +0100
Subject: [PATCH 5/7] Update nut_check_libopenssl.m4
---
m4/nut_check_libopenssl.m4 | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4
index 5f29f4a38..7eb401cd9 100644
--- a/m4/nut_check_libopenssl.m4
+++ b/m4/nut_check_libopenssl.m4
@@ -57,9 +57,8 @@ if test -z "${nut_have_libopenssl_seen}"; then
AC_MSG_RESULT([${LIBS}])
dnl check if openssl is usable
- AC_CHECK_FUNCS(OPENSSL_init_ssl, [nut_have_openssl=yes], [nut_have_openssl=no])
- AC_CHECK_FUNCS(SSL_library_init, [nut_have_openssl=yes], [])
- AC_CHECK_HEADERS(openssl/ssl.h, [], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT])
+ AC_CHECK_HEADERS(openssl/ssl.h, [nut_have_openssl=yes], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT])
+ AC_CHECK_FUNCS(SSL_CTX_new, [], [nut_have_openssl=no])
if test "${nut_have_openssl}" = "yes"; then
nut_with_ssl="yes"
From 1dc34a5da7308f0f85537a6761fefb3ff3098863 Mon Sep 17 00:00:00 2001
From: Arjen de Korte <build+github@de-korte.org>
Date: Sun, 24 Feb 2019 18:34:53 +0100
Subject: [PATCH 6/7] Update upsclient.c
---
clients/upsclient.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/clients/upsclient.c b/clients/upsclient.c
index b7dd8f424..541664f36 100644
--- a/clients/upsclient.c
+++ b/clients/upsclient.c
@@ -311,15 +311,12 @@ int upscli_init(int certverify, const char *certpath,
#ifdef WITH_OPENSSL
- SSL_load_error_strings();
-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ SSL_load_error_strings();
SSL_library_init();
ssl_ctx = SSL_CTX_new(SSLv23_client_method());
#else
- OPENSSL_init_ssl(0, NULL);
-
ssl_ctx = SSL_CTX_new(TLS_client_method());
#endif
From 108c31c9b170da2ee34a25fd373d21837d4d10a3 Mon Sep 17 00:00:00 2001
From: Arjen de Korte <build+github@de-korte.org>
Date: Sun, 24 Feb 2019 18:37:42 +0100
Subject: [PATCH 7/7] Update netssl.c
---
server/netssl.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/server/netssl.c b/server/netssl.c
index 6ae13e8d3..cf9419edf 100644
--- a/server/netssl.c
+++ b/server/netssl.c
@@ -381,15 +381,12 @@ void ssl_init(void)
#ifdef WITH_OPENSSL
- SSL_load_error_strings();
-
#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ SSL_load_error_strings();
SSL_library_init();
ssl_ctx = SSL_CTX_new(SSLv23_server_method());
#else
- OPENSSL_init_ssl(0, NULL);
-
ssl_ctx = SSL_CTX_new(TLS_server_method());
#endif

View file

@ -28,5 +28,5 @@ do
echo "#define $( echo "$l" | tr '[a-z]-' '[A-Z]_')_PATH \"$rp\""
done
VINFO=$(sed -e '/version-info/!d' -e 's/#.*$//' -e 's/^.*-version-info//' -e 's/[[:space:]]//g' clients/Makefile)
VINFO=$(sed -e '/version-info/!d' -e 's/#.*$//' -e 's/^.*-version-info//' -e 's/[[:space:]]//g' -e 's/\\//g' clients/Makefile)
echo "#define LIBUPSCLIENT_PATH \"libupsclient.so.$(( ${VINFO%%:*}-${VINFO##*:} ))\""

View file

@ -5,7 +5,7 @@ diff -up nut-2.8.0/scripts/systemd/nut-driver-enumerator.service.in.tmpfiles nut
# don't want it to fail the unit (when it can't restart).
Environment=REPORT_RESTART_42=no
EnvironmentFile=-@CONFPATH@/nut.conf
+ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-client.conf
+ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-common.conf
ExecStart=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh
ExecReload=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh
@ -16,7 +16,7 @@ diff -up nut-2.8.0/scripts/systemd/nut-driver@.service.in.tmpfiles nut-2.8.0/scr
[Service]
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N
+ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-client.conf
+ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-common.conf
ExecStart=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl start "$NUTDEV"'
ExecStop=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl stop "$NUTDEV"'
# Restart really always, do not stop trying:
@ -27,7 +27,7 @@ diff -up nut-2.8.0/scripts/systemd/nut-monitor.service.in.tmpfiles nut-2.8.0/scr
[Service]
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N
+ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-client.conf
+ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-common.conf
ExecStart=@SBINDIR@/upsmon -F
ExecReload=@SBINDIR@/upsmon -c reload
PIDFile=@PIDPATH@/upsmon.pid

View file

@ -1,25 +0,0 @@
diff -up nut-2.7.4/tools/nut-scanner/scan_avahi.c.dlfix nut-2.7.4/tools/nut-scanner/scan_avahi.c
diff -up nut-2.7.4/tools/nut-scanner/scan_ipmi.c.dlfix nut-2.7.4/tools/nut-scanner/scan_ipmi.c
diff -up nut-2.7.4/tools/nut-scanner/scan_nut.c.dlfix nut-2.7.4/tools/nut-scanner/scan_nut.c
diff -up nut-2.7.4/tools/nut-scanner/scan_snmp.c.dlfix nut-2.7.4/tools/nut-scanner/scan_snmp.c
diff -up nut-2.7.4/tools/nut-scanner/scan_usb.c.dlfix nut-2.7.4/tools/nut-scanner/scan_usb.c
diff -up nut-2.7.4/tools/nut-scanner/scan_xml_http.c.dlfix nut-2.7.4/tools/nut-scanner/scan_xml_http.c
--- nut-2.7.4/tools/nut-scanner/scan_xml_http.c.dlfix 2016-03-08 13:01:11.000000000 +0100
+++ nut-2.7.4/tools/nut-scanner/scan_xml_http.c 2016-03-12 00:23:02.554826665 +0100
@@ -37,7 +37,6 @@
#include <ltdl.h>
/* dynamic link library stuff */
-static char * libname = "libneon";
static lt_dlhandle dl_handle = NULL;
static const char *dl_error = NULL;
@@ -102,7 +101,7 @@ int nutscan_load_neon_library(const char
return 1;
err:
- fprintf(stderr, "Cannot load XML library (%s) : %s. XML search disabled.\n", libname, dl_error);
+ fprintf(stderr, "Cannot load XML library (%s) : %s. XML search disabled.\n", libname_path, dl_error);
dl_handle = (void *)1;
lt_dlexit();
return 0;

View file

@ -1,129 +0,0 @@
diff -up nut-2.7.1/clients/upsmon.c.foreground nut-2.7.1/clients/upsmon.c
--- nut-2.7.1/clients/upsmon.c.foreground 2013-07-26 21:41:10.000000000 +0200
+++ nut-2.7.1/clients/upsmon.c 2014-02-27 11:39:58.158784578 +0100
@@ -1645,6 +1645,7 @@ static void help(const char *progname)
printf(" - reload: reread configuration\n");
printf(" - stop: stop monitoring and exit\n");
printf(" -D raise debugging level\n");
+ printf(" -F run in foreground, do not daemonize\n");
printf(" -h display this help\n");
printf(" -K checks POWERDOWNFLAG, sets exit code to 0 if set\n");
printf(" -p always run privileged (disable privileged parent)\n");
@@ -1859,7 +1860,7 @@ static void check_parent(void)
int main(int argc, char *argv[])
{
const char *prog = xbasename(argv[0]);
- int i, cmd = 0, checking_flag = 0;
+ int i, cmd = 0, checking_flag = 0, foreground = 0;
printf("Network UPS Tools %s %s\n", prog, UPS_VERSION);
@@ -1870,7 +1871,7 @@ int main(int argc, char *argv[])
run_as_user = xstrdup(RUN_AS_USER);
- while ((i = getopt(argc, argv, "+Dhic:f:pu:VK46")) != -1) {
+ while ((i = getopt(argc, argv, "+DFhic:f:pu:VK46")) != -1) {
switch (i) {
case 'c':
if (!strncmp(optarg, "fsd", strlen(optarg)))
@@ -1887,6 +1888,9 @@ int main(int argc, char *argv[])
case 'D':
nut_debug_level++;
break;
+ case 'F':
+ foreground = 1;
+ break;
case 'f':
free(configfile);
configfile = xstrdup(optarg);
@@ -1962,9 +1966,9 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- if (nut_debug_level < 1) {
+ if (!foreground && nut_debug_level < 1) {
background();
- } else {
+ } else if (nut_debug_level >= 1) {
upsdebugx(1, "debug level is '%d'", nut_debug_level);
}
diff -up nut-2.7.1/scripts/systemd/nut-monitor.service.in.foreground nut-2.7.1/scripts/systemd/nut-monitor.service.in
--- nut-2.7.1/scripts/systemd/nut-monitor.service.in.foreground 2014-02-27 11:39:58.141784438 +0100
+++ nut-2.7.1/scripts/systemd/nut-monitor.service.in 2014-02-27 11:39:58.152784529 +0100
@@ -4,9 +4,8 @@ After=local-fs.target network.target nut
[Service]
ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-client.conf
-ExecStart=@SBINDIR@/upsmon
-PIDFile=@PIDPATH@/upsmon.pid
-Type=forking
+ExecStart=@SBINDIR@/upsmon -F
+Type=simple
[Install]
WantedBy=multi-user.target
diff -up nut-2.7.1/scripts/systemd/nut-server.service.in.foreground nut-2.7.1/scripts/systemd/nut-server.service.in
--- nut-2.7.1/scripts/systemd/nut-server.service.in.foreground 2013-07-26 21:41:11.000000000 +0200
+++ nut-2.7.1/scripts/systemd/nut-server.service.in 2014-02-27 11:39:58.152784529 +0100
@@ -5,8 +5,8 @@ Requires=nut-driver.service
Before=nut-monitor.service
[Service]
-ExecStart=@SBINDIR@/upsd
-Type=forking
+ExecStart=@SBINDIR@/upsd -F
+Type=simple
[Install]
WantedBy=multi-user.target
diff -up nut-2.7.1/server/upsd.c.foreground nut-2.7.1/server/upsd.c
--- nut-2.7.1/server/upsd.c.foreground 2013-07-26 21:41:11.000000000 +0200
+++ nut-2.7.1/server/upsd.c 2014-02-27 11:39:58.153784537 +0100
@@ -827,6 +827,7 @@ static void help(const char *progname)
printf(" - reload: reread configuration files\n");
printf(" - stop: stop process and exit\n");
printf(" -D raise debugging level\n");
+ printf(" -F run in foreground, do not daemonize\n");
printf(" -h display this help\n");
printf(" -r <dir> chroots to <dir>\n");
printf(" -q raise log level threshold\n");
@@ -890,7 +891,7 @@ void check_perms(const char *fn)
int main(int argc, char **argv)
{
- int i, cmd = 0;
+ int i, cmd = 0, foreground = 0;
char *chroot_path = NULL;
const char *user = RUN_AS_USER;
struct passwd *new_uid = NULL;
@@ -906,7 +907,7 @@ int main(int argc, char **argv)
printf("Network UPS Tools %s %s\n", progname, UPS_VERSION);
- while ((i = getopt(argc, argv, "+h46p:qr:i:fu:Vc:D")) != -1) {
+ while ((i = getopt(argc, argv, "+hF46p:qr:i:fu:Vc:D")) != -1) {
switch (i) {
case 'h':
help(progname);
@@ -944,6 +945,10 @@ int main(int argc, char **argv)
nut_debug_level++;
break;
+ case 'F':
+ foreground = 1;
+ break;
+
case '4':
opt_af = AF_INET;
break;
@@ -1031,7 +1036,7 @@ int main(int argc, char **argv)
/* handle upsd.users */
user_load();
- if (!nut_debug_level) {
+ if (!nut_debug_level && !foreground) {
background();
writepid(pidfn);
} else {

View file

@ -1,12 +0,0 @@
diff -up nut-2.7.3/configure.ac.quickfix nut-2.7.3/configure.ac
--- nut-2.7.3/configure.ac.quickfix 2015-04-23 12:05:21.219228670 +0200
+++ nut-2.7.3/configure.ac 2015-04-23 12:05:21.230228646 +0200
@@ -1065,7 +1065,7 @@ dnl Override installation directory, wit
dnl prefix. This is needed for 'distcheck*' targets, otherwise
dnl files will try to get intalled to the actual system directories
if test -n "${systemdsystemunitdir}"; then
- systemdsystemshutdowndir="${libdir}/systemd/system-shutdown"
+ systemdsystemshutdowndir="/lib/systemd/system-shutdown"
AC_MSG_RESULT(using ${systemdsystemunitdir})
else
AC_MSG_RESULT(no)

View file

@ -1,18 +1,18 @@
diff -up nut-2.8.0/clients/upsmon.c.rmpidf nut-2.8.0/clients/upsmon.c
--- nut-2.8.0/clients/upsmon.c.rmpidf 2022-04-23 13:56:06.000000000 +0200
+++ nut-2.8.0/clients/upsmon.c 2022-05-09 17:22:34.329547283 +0200
@@ -2314,6 +2314,7 @@ int main(int argc, char *argv[])
diff -up nut-2.8.2.1/clients/upsmon.c.rmpidf nut-2.8.2.1/clients/upsmon.c
--- nut-2.8.2.1/clients/upsmon.c.rmpidf 2024-07-03 12:18:04.788135176 +0200
+++ nut-2.8.2.1/clients/upsmon.c 2024-07-03 12:19:33.164964473 +0200
@@ -3309,6 +3309,7 @@ int main(int argc, char *argv[])
upslogx(LOG_INFO, "Signal %d: exiting", exit_flag);
upsnotify(NOTIFY_STATE_STOPPING, "Signal %d: exiting", exit_flag);
upsmon_cleanup();
+ cleanpid(prog);
upsdebugx(1, "Finally exiting due to signal %d", exit_flag);
exit(EXIT_SUCCESS);
}
diff -up nut-2.8.0/common/common.c.rmpidf nut-2.8.0/common/common.c
--- nut-2.8.0/common/common.c.rmpidf 2022-05-09 17:22:34.329547283 +0200
+++ nut-2.8.0/common/common.c 2022-05-09 17:26:48.671847245 +0200
@@ -358,6 +358,20 @@ pid_t parsepid(const char *buf)
diff -up nut-2.8.2.1/common/common.c.rmpidf nut-2.8.2.1/common/common.c
--- nut-2.8.2.1/common/common.c.rmpidf 2024-07-03 12:14:56.000000000 +0200
+++ nut-2.8.2.1/common/common.c 2024-07-03 12:18:04.788135176 +0200
@@ -1338,6 +1338,20 @@ pid_t parsepid(const char *buf)
return pid;
}
@ -33,10 +33,10 @@ diff -up nut-2.8.0/common/common.c.rmpidf nut-2.8.0/common/common.c
/* open pidfn, get the pid, then send it sig
* returns negative codes for errors, or
* zero for a successfully sent signal
diff -up nut-2.8.0/include/common.h.rmpidf nut-2.8.0/include/common.h
--- nut-2.8.0/include/common.h.rmpidf 2022-05-09 17:22:34.329547283 +0200
+++ nut-2.8.0/include/common.h 2022-05-09 17:25:47.439740973 +0200
@@ -103,6 +103,9 @@ void chroot_start(const char *path);
diff -up nut-2.8.2.1/include/common.h.rmpidf nut-2.8.2.1/include/common.h
--- nut-2.8.2.1/include/common.h.rmpidf 2024-07-03 12:14:56.000000000 +0200
+++ nut-2.8.2.1/include/common.h 2024-07-03 12:18:04.788135176 +0200
@@ -262,6 +262,9 @@ int checkprocname(pid_t pid, const char
/* write a pid file - <name> is a full pathname *or* just the program name */
void writepid(const char *name);
@ -46,14 +46,13 @@ diff -up nut-2.8.0/include/common.h.rmpidf nut-2.8.0/include/common.h
/* parses string buffer into a pid_t if it passes
* a few sanity checks; returns -1 on error */
pid_t parsepid(const char *buf);
diff -up nut-2.8.0/server/upsd.c.rmpidf nut-2.8.0/server/upsd.c
--- nut-2.8.0/server/upsd.c.rmpidf 2022-04-23 13:56:07.000000000 +0200
+++ nut-2.8.0/server/upsd.c 2022-05-09 17:22:34.330547269 +0200
@@ -1515,6 +1515,7 @@ int main(int argc, char **argv)
ssl_cleanup();
diff -up nut-2.8.2.1/server/upsd.c.rmpidf nut-2.8.2.1/server/upsd.c
--- nut-2.8.2.1/server/upsd.c.rmpidf 2024-07-03 12:14:56.000000000 +0200
+++ nut-2.8.2.1/server/upsd.c 2024-07-03 12:18:04.789135186 +0200
@@ -2304,5 +2304,6 @@ int main(int argc, char **argv)
upsnotify(NOTIFY_STATE_STOPPING, "Signal %d: exiting", exit_flag);
upslogx(LOG_INFO, "Signal %d: exiting", exit_flag);
ssl_cleanup();
+ if (*pidfn) cleanpid(pidfn);
return EXIT_SUCCESS;
}

View file

@ -1,40 +0,0 @@
diff -up nut-2.8.0/scripts/python/app/NUT-Monitor-py3qt5.in.unreachable nut-2.8.0/scripts/python/app/NUT-Monitor-py3qt5.in
--- nut-2.8.0/scripts/python/app/NUT-Monitor-py3qt5.in.unreachable 2022-05-09 17:20:11.629621005 +0200
+++ nut-2.8.0/scripts/python/app/NUT-Monitor-py3qt5.in 2022-05-09 17:20:52.674024537 +0200
@@ -693,6 +693,11 @@ along with this program. If not, see <h
self.gui_status_notification( _("Device '%s' not found on server") % self.__current_ups, "warning.png" )
return
+ if not self.__ups_handler.CheckUPSAvailable( self.__current_ups ):
+ self.gui_status_message( _("UPS '{0}' is not reachable").format( self.__current_ups ) )
+ self.gui_status_notification( _("UPS '{0}' is not reachable").format( self.__current_ups ), "warning.png" )
+ return
+
self.__connected = True
self.__widgets["ups_connect"].hide()
self.__widgets["ups_disconnect"].show()
diff -up nut-2.8.0/scripts/python/module/PyNUT.py.in.unreachable nut-2.8.0/scripts/python/module/PyNUT.py.in
--- nut-2.8.0/scripts/python/module/PyNUT.py.in.unreachable 2022-05-09 17:20:32.100323526 +0200
+++ nut-2.8.0/scripts/python/module/PyNUT.py.in 2022-05-09 17:21:35.505402117 +0200
@@ -170,6 +170,21 @@ available vars.
return( ups_vars )
+ def CheckUPSAvailable( self, ups="") :
+ """ Check whether UPS is reachable
+
+Just tries to contact UPS with safe command.
+The result is True (rechable) or False (unreachable)
+ """
+ self.__srv_handler.write( "LIST CMD %s\n" % ups )
+ result = self.__srv_handler.read_until( "\n" )
+ if result != "BEGIN LIST CMD %s\n" % ups :
+ return False
+
+ self.__srv_handler.read_until( "END LIST CMD %s\n" % ups )
+ return True
+
+
def GetUPSCommands( self, ups="" ) :
""" Get all available commands for the specified UPS

View file

@ -1,82 +0,0 @@
--- nut-2.7.4/common/parseconf.c.cloexec 2018-12-07 15:56:22.989381441 -0800
+++ nut-2.7.4/common/parseconf.c 2018-12-07 16:48:33.912337591 -0800
@@ -83,6 +83,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <fcntl.h>
#include "parseconf.h"
@@ -443,6 +444,9 @@
return 0;
}
+ /* prevent fd leaking to child processes */
+ fcntl(fileno(ctx->f), F_SETFD, FD_CLOEXEC);
+
return 1; /* OK */
}
--- nut-2.7.4/clients/upsmon.c.cloexec 2018-12-07 16:22:42.185376803 -0800
+++ nut-2.7.4/clients/upsmon.c 2018-12-07 17:18:44.662093479 -0800
@@ -24,6 +24,8 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/socket.h>
+#include <unistd.h>
+#include <fcntl.h>
#include "upsclient.h"
#include "upsmon.h"
@@ -1432,6 +1434,9 @@
/* we're definitely connected now */
setflag(&ups->status, ST_CONNECTED);
+ /* prevent connection leaking to NOTIFYCMD */
+ fcntl(upscli_fd(&ups->conn), F_SETFD, FD_CLOEXEC);
+
/* now try to authenticate to upsd */
ret = do_upsd_auth(ups);
@@ -1715,6 +1720,9 @@
}
close(pipefd[0]);
+
+ /* prevent pipe leaking to NOTIFYCMD */
+ fcntl(pipefd[1], F_SETFD, FD_CLOEXEC);
}
static void delete_ups(utype_t *target)
--- nut-2.7.4/clients/upssched.c.cloexec 2018-12-07 17:09:13.081914570 -0800
+++ nut-2.7.4/clients/upssched.c 2018-12-07 18:28:54.380512191 -0800
@@ -46,6 +46,8 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
+#include <unistd.h>
+#include <fcntl.h>
#include "upssched.h"
#include "timehead.h"
@@ -297,6 +299,9 @@
if (ret < 0)
fatal_with_errno(EXIT_FAILURE, "listen(%d, %d) failed", fd, US_LISTEN_BACKLOG);
+ /* don't leak socket to CMDSCRIPT */
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+
return fd;
}
@@ -370,6 +375,9 @@
return;
}
+ /* don't leak connection to CMDSCRIPT */
+ fcntl(acc, F_SETFD, FD_CLOEXEC);
+
/* enable nonblocking I/O */
ret = fcntl(acc, F_GETFL, 0);

View file

@ -1,20 +0,0 @@
diff -urNp a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am
--- a/tools/nut-scanner/Makefile.am 2020-09-02 10:16:27.304816091 +0200
+++ b/tools/nut-scanner/Makefile.am 2020-09-02 10:17:58.119811844 +0200
@@ -14,14 +14,14 @@ libnutscan_la_SOURCES = scan_nut.c scan_
scan_avahi.c scan_eaton_serial.c nutscan-serial.c \
../../drivers/serial.c \
../../drivers/bcmxcp_ser.c \
- ../../common/common.c
+ ../../common/common.c ../../common/str.c
libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS)
libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0
libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers
nut_scanner_SOURCES = nut-scanner.c
nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include
-nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la
+nut_scanner_LDADD = libnutscan.la
if WITH_SSL
libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS)

View file

@ -1,16 +0,0 @@
diff -up nut-2.7.4/drivers/snmp-ups.c.scratchdes nut-2.7.4/drivers/snmp-ups.c
--- nut-2.7.4/drivers/snmp-ups.c.scratchdes 2021-06-08 13:56:32.608702337 +0200
+++ nut-2.7.4/drivers/snmp-ups.c 2021-06-08 13:56:32.622702201 +0200
@@ -471,11 +471,7 @@ void nut_snmp_init(const char *type, con
privProtocol = testvar(SU_VAR_PRIVPROT) ? getval(SU_VAR_PRIVPROT) : "DES";
- if (strcmp(privProtocol, "DES") == 0) {
- g_snmp_sess.securityPrivProto = usmDESPrivProtocol;
- g_snmp_sess.securityPrivProtoLen = sizeof(usmDESPrivProtocol)/sizeof(oid);
- }
- else if (strcmp(privProtocol, "AES") == 0) {
+ if (strcmp(privProtocol, "AES") == 0) {
g_snmp_sess.securityPrivProto = usmAESPrivProtocol;
g_snmp_sess.securityPrivProtoLen = sizeof(usmAESPrivProtocol)/sizeof(oid);
}

View file

@ -0,0 +1,50 @@
diff -up nut-2.8.1/configure.ac.piddir-owner nut-2.8.1/configure.ac
--- nut-2.8.1/configure.ac.piddir-owner 2023-11-01 09:39:24.267596406 +0100
+++ nut-2.8.1/configure.ac 2023-11-01 10:00:35.425987029 +0100
@@ -4451,7 +4451,7 @@ AS_IF([test -n "$systemdtmpfilesdir"],
# See also: https://github.com/networkupstools/nut/wiki/Technicalities:-Work-with-PID-and-state-file-paths#pidpath-altpidpath-statepath
# State file (e.g. upsd to driver pipes) and PID file location for NUT:
-d @STATEPATH@ 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
+d @STATEPATH@ 0770 root @RUN_AS_GROUP@ - -
# Default PIPEFN and LOCKFN locations per upssched.conf:
d @STATEPATH@/upssched 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
X @STATEPATH@
@@ -4461,7 +4461,7 @@ EOF
[*/run|*/tmp|*/shm], [], dnl Do not intrude into system paths; TODO: add more if appropriate for some Linux distro
[cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common-tmpfiles.conf.in << EOF
# Primarily used by upsmon and upslog, possibly running as root:
-d @PIDPATH@ 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
+d @PIDPATH@ 0770 root @RUN_AS_GROUP@ - -
X @PIDPATH@
EOF
])])
@@ -4469,14 +4469,14 @@ EOF
[cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common-tmpfiles.conf.in << EOF
# Should be used as upsd and driver PID file location for NUT
# (if ALTPIDPATH differs from STATEPATH):
-d @ALTPIDPATH@ 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
+d @ALTPIDPATH@ 0770 root @RUN_AS_GROUP@ - -
X @ALTPIDPATH@
EOF])
dnl Generally added to support some forks
AS_IF([test -n "$ALTSTATEPATH" && test "$STATEPATH" != "$ALTSTATEPATH" && test "$ALTSTATEPATH" != "$ALTPIDPATH" && test "$PIDPATH" != "$ALTSTATEPATH"],
[cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common-tmpfiles.conf.in << EOF
# Some NUT variants also maintain an ALTSTATEPATH:
-d @ALTSTATEPATH@ 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
+d @ALTSTATEPATH@ 0770 root @RUN_AS_GROUP@ - -
X @ALTSTATEPATH@
EOF])
])
diff -up nut-2.8.1/scripts/systemd/nut-common-tmpfiles.conf.in.piddir-owner nut-2.8.1/scripts/systemd/nut-common-tmpfiles.conf.in
--- nut-2.8.1/scripts/systemd/nut-common-tmpfiles.conf.in.piddir-owner 2023-10-31 23:05:03.000000000 +0100
+++ nut-2.8.1/scripts/systemd/nut-common-tmpfiles.conf.in 2023-11-01 10:03:46.970845553 +0100
@@ -5,7 +5,7 @@
# See also: https://github.com/networkupstools/nut/wiki/Technicalities:-Work-with-PID-and-state-file-paths#pidpath-altpidpath-statepath
# State file (e.g. upsd to driver pipes) and PID file location for NUT:
-d @STATEPATH@ 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
+d @STATEPATH@ 0770 root @RUN_AS_GROUP@ - -
# Default PIPEFN and LOCKFN locations per upssched.conf:
d @STATEPATH@/upssched 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
X @STATEPATH@

23
nut-2.8.3-rhinoname.patch Normal file
View file

@ -0,0 +1,23 @@
diff -up nut-2.8.4-build/nut-2.8.4/drivers/Makefile.am.rhinoname nut-2.8.4-build/nut-2.8.4/drivers/Makefile.am
--- nut-2.8.4-build/nut-2.8.4/drivers/Makefile.am.rhinoname 2025-08-14 11:08:48.763700333 +0200
+++ nut-2.8.4-build/nut-2.8.4/drivers/Makefile.am 2025-08-14 11:29:43.803846801 +0200
@@ -74,7 +74,7 @@ NUTSW_DRIVERLIST = $(NUTSW_DRIVERLIST_DU
SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \
bestfortress bestuferrups bestups etapro everups \
gamatronic genericups isbmex liebert liebert-esp2 liebert-gxe masterguard metasys \
- mge-utalk microdowell microsol-apc mge-shut nutdrv_hashx oneac optiups powercom powervar_cx_ser rhino \
+ mge-utalk microdowell microsol-apc mge-shut nutdrv_hashx oneac optiups powercom powervar_cx_ser nutdrv_rhino \
safenet nutdrv_siemens-sitop solis tripplite tripplitesu upscode2 victronups powerpanel \
blazer_ser ivtscd apcsmart apcsmart-old riello_ser sms_ser bicker_ser ve-direct
if HAVE_LINUX_SERIAL_H
@@ -198,8 +198,8 @@ powerpanel_SOURCES = powerpanel.c powerp
powerpanel_LDADD = $(LDADD) -lm
powervar_cx_ser_SOURCES = powervar_cx_ser.c powervar_cx.c
powervar_cx_ser_CFLAGS = $(AM_CFLAGS) -DPVAR_SERIAL=1
-rhino_SOURCES = rhino.c
-rhino_LDADD = $(LDADD) -lm
+nutdrv_rhino_SOURCES = rhino.c
+nutdrv_rhino_LDADD = $(LDADD) -lm
safenet_SOURCES = safenet.c
nutdrv_siemens_sitop_SOURCES = nutdrv_siemens_sitop.c
solis_SOURCES = solis.c

17
nut-c99-strdup.patch Normal file
View file

@ -0,0 +1,17 @@
Fix strdup configure test: Remove a call to the undeclared free
function.
Submitted upstream: <https://github.com/networkupstools/nut/pull/1720>
diff --git a/configure.ac b/configure.ac
index 3aa26c24ebc99bb6..c93ccd1e494874d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -294,7 +294,6 @@ AC_CACHE_CHECK([for strdup(s)],
char *t = "Test";
char *s = strdup(t);
if (!s || !(s[0]=='T'&&s[1]=='e'&&s[2]=='s'&&s[3]=='t'&&s[4]=='\0') || s == t) res = 1;
-if (s) free (s);
if (res != 0) return res
/* autoconf adds ";return 0;" */
]])],

View file

@ -1 +0,0 @@
D /run/nut 0770 root nut -

865
nut.spec

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
SHA512 (nut-2.8.0.tar.gz) = 3c413ae54088045a713eb80cf1bdda474f41bb3b67c7c0248aa7a0c4d441dce1ff42627a2735273d7e36892d1f2eeb895220cf28af63fec2fa0c7a267f82d577
SHA512 (nut-2.8.4.tar.gz) = 0d87c0006608f92ae54f8a500f93d9a81eac1d9abf57f32e7718dd72f265b8293a0b6cdba04c802b81eaf8907b52669c36b47b6875a4377f9752845ac6c5e8fa

147
ups.init
View file

@ -1,147 +0,0 @@
#! /bin/bash
#
# ups: Starts the Network UPS Tools
#
# chkconfig: - 26 74
# description: Network UPS Tools is a collection of programs which provide a common \
# interface for monitoring and administering UPS hardware.
# processname: upsd
# config: /etc/ups/
# config: /etc/sysconfig/ups
#
### BEGIN INIT INFO
# Provides: ups
# Required-Start: $syslog $network $named
# Required-Stop: $local_fs
# Default-Stop: 0 1 6
# Short-Description: Starts the Network UPS tools
# Description: Network UPS Tools is a collection of programs which provide a common \
# interface for monitoring and administering UPS hardware.
### END INIT INFO
# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
# Get config.
if [ -f /etc/sysconfig/ups ]; then
. /etc/sysconfig/ups
else
SERVER="no"
fi
start() {
if [ "$SERVER" = "yes" ]; then
echo -n $"Starting UPS driver controller: "
daemon /sbin/upsdrvctl start > /dev/null 2>&1 && success || failure
RETVAL=$?
echo
prog="upsd"
echo -n $"Starting $prog: "
daemon /usr/sbin/upsd $UPSD_OPTIONS > /dev/null 2>&1 && success || failure
if [ "$RETVAL" = 0 ]; then
RETVAL=$?
fi
echo
echo -n $"Starting UPS monitor (master): "
daemon --pidfile /var/run/nut/upsmon.pid /usr/sbin/upsmon > /dev/null 2>&1 && success || failure
if [ "$RETVAL" = 0 ]; then
RETVAL=$?
fi
echo
else
echo -n $"Starting UPS monitor (slave): "
daemon --pidfile /var/run/nut/upsmon.pid /usr/sbin/upsmon > /dev/null 2>&1 && success || failure
echo
fi
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/ups
}
stop() {
echo -n $"Stopping UPS monitor: "
killproc -p /var/run/nut/upsmon.pid upsmon
echo
if [ "$SERVER" = "yes" ]; then
prog="upsd"
echo -n $"Stopping $prog: "
killproc upsd > /dev/null 2>&1 && success || failure
RETVAL=$?
echo
echo -n $"Shutting down UPS driver controller: "
/sbin/upsdrvctl stop > /dev/null 2>&1 && success || failure
if [ "$RETVAL" = 0 ]; then
RETVAL=$?
fi
echo
fi
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/ups
}
restart() {
stop
waitmore=5
while [ -n "$(ls /var/run/nut/)" -a $waitmore -ge 1 ]
do
sleep 1
waitmore=$((waitmore-1))
done
start
}
reload() {
# FIXME: upsd and upsmon always return 0
# => can't tell if reload was successful
if [ "$SERVER" = "yes" ]; then
action "Reloading upsd:" /usr/sbin/upsd -c reload
RETVAL=$?
fi
action "Reloading upsmon:" /usr/sbin/upsmon -c reload
if [ "$RETVAL" = 0 ]; then
RETVAL=$?
fi
}
# See how we are called.
case "$1" in
start)
start ;;
stop)
stop ;;
restart)
restart ;;
try-restart)
[ -f /var/lock/subsys/ups ] && restart || :
;;
reload)
reload ;;
force-reload)
restart ;;
status)
if [ "$SERVER" = "yes" ]; then
status upsd
fi
status upsmon
;;
*)
echo $"Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}"
RETVAL=3
esac
exit $RETVAL

View file

@ -1,8 +0,0 @@
# If the UPS is locally attached set it to "yes"
SERVER=yes
# Any options to pass to upsd
UPSD_OPTIONS=
# This *must* be the same as in /etc/ups/upsmon.conf
POWERDOWNFLAG=/etc/killpower
#
# [End]