diff --git a/.gitignore b/.gitignore index a737052..b466deb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,3 @@ 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 diff --git a/504.patch b/504.patch new file mode 100644 index 0000000..71e1bf4 --- /dev/null +++ b/504.patch @@ -0,0 +1,333 @@ +From da1f5aa699f54e0f6977ab64a3bc2f90a51c3104 Mon Sep 17 00:00:00 2001 +From: Arjen de Korte +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 +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 +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 +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 +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 +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 +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 + diff --git a/libs.sh b/libs.sh index 641d9ad..a6ca8a8 100644 --- a/libs.sh +++ b/libs.sh @@ -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' -e 's/\\//g' clients/Makefile) +VINFO=$(sed -e '/version-info/!d' -e 's/#.*$//' -e 's/^.*-version-info//' -e 's/[[:space:]]//g' clients/Makefile) echo "#define LIBUPSCLIENT_PATH \"libupsclient.so.$(( ${VINFO%%:*}-${VINFO##*:} ))\"" diff --git a/nut-2.6.3-tmpfiles.patch b/nut-2.6.3-tmpfiles.patch index d1f09b4..7f7cd98 100644 --- a/nut-2.6.3-tmpfiles.patch +++ b/nut-2.6.3-tmpfiles.patch @@ -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-common.conf ++ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-client.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-common.conf ++ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-client.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-common.conf ++ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-client.conf ExecStart=@SBINDIR@/upsmon -F ExecReload=@SBINDIR@/upsmon -c reload PIDFile=@PIDPATH@/upsmon.pid diff --git a/nut-2.6.5-dlfix.patch b/nut-2.6.5-dlfix.patch new file mode 100644 index 0000000..f93b5ea --- /dev/null +++ b/nut-2.6.5-dlfix.patch @@ -0,0 +1,25 @@ +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 + + /* 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; diff --git a/nut-2.6.5-foreground.patch b/nut-2.6.5-foreground.patch new file mode 100644 index 0000000..4064b86 --- /dev/null +++ b/nut-2.6.5-foreground.patch @@ -0,0 +1,129 @@ +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 chroots to \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 { diff --git a/nut-2.6.5-quickfix.patch b/nut-2.6.5-quickfix.patch new file mode 100644 index 0000000..aa11fe6 --- /dev/null +++ b/nut-2.6.5-quickfix.patch @@ -0,0 +1,12 @@ +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) diff --git a/nut-2.6.5-rmpidf.patch b/nut-2.6.5-rmpidf.patch index 40365b8..54c6e1e 100644 --- a/nut-2.6.5-rmpidf.patch +++ b/nut-2.6.5-rmpidf.patch @@ -1,18 +1,18 @@ -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[]) +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[]) + 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.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) + } +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) return pid; } @@ -33,10 +33,10 @@ diff -up nut-2.8.2.1/common/common.c.rmpidf nut-2.8.2.1/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.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 +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); /* write a pid file - is a full pathname *or* just the program name */ void writepid(const char *name); @@ -46,13 +46,14 @@ diff -up nut-2.8.2.1/include/common.h.rmpidf nut-2.8.2.1/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.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); - +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(); + + upslogx(LOG_INFO, "Signal %d: exiting", exit_flag); + if (*pidfn) cleanpid(pidfn); return EXIT_SUCCESS; } + diff --git a/nut-2.6.5-unreachable.patch b/nut-2.6.5-unreachable.patch new file mode 100644 index 0000000..4166e84 --- /dev/null +++ b/nut-2.6.5-unreachable.patch @@ -0,0 +1,40 @@ +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 + #include + #include ++#include + + #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 + #include + #include ++#include ++#include + + #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 + #include + #include ++#include ++#include + + #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); diff --git a/nut-2.7.4-nutscanner-FTBFS.patch b/nut-2.7.4-nutscanner-FTBFS.patch new file mode 100644 index 0000000..fcb4f37 --- /dev/null +++ b/nut-2.7.4-nutscanner-FTBFS.patch @@ -0,0 +1,20 @@ +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) diff --git a/nut-2.7.4-scratchdes.patch b/nut-2.7.4-scratchdes.patch new file mode 100644 index 0000000..eb793d2 --- /dev/null +++ b/nut-2.7.4-scratchdes.patch @@ -0,0 +1,16 @@ +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); + } diff --git a/nut-2.8.0-piddir-owner.patch b/nut-2.8.0-piddir-owner.patch deleted file mode 100644 index 53e639d..0000000 --- a/nut-2.8.0-piddir-owner.patch +++ /dev/null @@ -1,50 +0,0 @@ -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@ diff --git a/nut-2.8.3-rhinoname.patch b/nut-2.8.3-rhinoname.patch deleted file mode 100644 index 71be46d..0000000 --- a/nut-2.8.3-rhinoname.patch +++ /dev/null @@ -1,23 +0,0 @@ -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 diff --git a/nut-c99-strdup.patch b/nut-c99-strdup.patch deleted file mode 100644 index 90c83db..0000000 --- a/nut-c99-strdup.patch +++ /dev/null @@ -1,17 +0,0 @@ -Fix strdup configure test: Remove a call to the undeclared free -function. - -Submitted upstream: - -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;" */ - ]])], diff --git a/nut-client.tmpfiles b/nut-client.tmpfiles new file mode 100644 index 0000000..df35b88 --- /dev/null +++ b/nut-client.tmpfiles @@ -0,0 +1 @@ +D /run/nut 0770 root nut - diff --git a/nut.spec b/nut.spec index dba51af..a46e894 100644 --- a/nut.spec +++ b/nut.spec @@ -1,4 +1,5 @@ %global _hardened_build 1 +%bcond_with python2 #TODO: split nut-client so it does not require python %global nut_uid 57 @@ -6,33 +7,38 @@ %global cgidir /var/www/nut-cgi-bin %global piddir /run/nut -%global modeldir %{_libexecdir}/%{name} +%global modeldir /usr/sbin # powerman is retired on Fedora, therefore disable it by default %bcond_with powerman Summary: Network UPS Tools Name: nut -Version: 2.8.4 +Version: 2.8.0 Release: 5%{?dist} -License: GPL-2.0-or-later AND GPL-3.0-or-later -Url: https://www.networkupstools.org/ -Source: https://www.networkupstools.org/source/2.8/%{name}-%{version}.tar.gz +License: GPLv2+ and GPLv3+ +Url: http://www.networkupstools.org/ +Source: http://www.networkupstools.org/source/2.8/%{name}-%{version}.tar.gz +Source3: nut-client.tmpfiles Source4: libs.sh -Patch2: nut-2.8.0-piddir-owner.patch +# Upstream support for OpenSSL-1.1.0, TLS > 1.0 +Patch0: https://patch-diff.githubusercontent.com/raw/networkupstools/nut/pull/504.patch +Patch1: nut-2.6.3-tmpfiles.patch #quick fix. TODO: fix it properly +Patch5: nut-2.6.5-dlfix.patch +Patch7: nut-2.6.5-foreground.patch +Patch8: nut-2.6.5-unreachable.patch Patch9: nut-2.6.5-rmpidf.patch -Patch15: nut-c99-strdup.patch -Patch16: nut-2.8.3-rhinoname.patch +Patch10: nut-2.7.4-cloexec.patch +Patch11: nut-2.7.4-nutscanner-FTBFS.patch +Patch12: nut-2.7.4-scratchdes.patch +Requires(pre): shadow-utils Requires(post): coreutils systemd Requires(preun): systemd Requires(postun): coreutils systemd -Recommends: nut-xml -Requires: group(dialout) -Requires: group(tty) +Obsoletes: nut-hal < 2.6.0-7 -BuildRequires: asciidoc BuildRequires: make BuildRequires: autoconf BuildRequires: automake @@ -48,10 +54,6 @@ BuildRequires: freetype-devel BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: gd-devel -BuildRequires: jq -%if 0%{?fedora} < 39 -BuildRequires: libgpiod-devel -%endif BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: libtool @@ -71,7 +73,7 @@ BuildRequires: powerman-devel %endif BuildRequires: python3-devel BuildRequires: python3-setuptools -BuildRequires: systemd-devel +BuildRequires: /usr/bin/pathfix.py BuildRequires: systemd-rpm-macros %ifnarch s390 s390x @@ -80,21 +82,25 @@ BuildRequires: libusb1-devel ExcludeArch: s390 s390x -%global restart_flag %{piddir}/%{name}-restart-after-rpm-install +%global restart_flag /run/%{name}/%{name}-restart-after-rpm-install %description -These programs are part of a developing project to monitor the assortment -of UPSes that are found out there in the field. Many models have serial +These programs are part of a developing project to monitor the assortment +of UPSes that are found out there in the field. Many models have serial ports of some kind that allow some form of state checking. This -capability has been harnessed where possible to allow for safe shutdowns, +capability has been harnessed where possible to allow for safe shutdowns, live status tracking on web pages, and more. %package client Summary: Network UPS Tools client monitoring utilities Requires(post): systemd Requires(preun): systemd -Requires: group(dialout) -Requires: group(tty) +Requires(pre): shadow-utils +%if %{with python2} +Requires: pygtk2, pygtk2-libglade +#only for python and gui part +%endif +#Requires: %description client This package includes the client utilities that are required to monitor a @@ -104,19 +110,12 @@ attached to a different computer on the network. %package cgi Summary: CGI utilities for the Network UPS Tools Requires: %{name}-client = %{version}-%{release} webserver +Requires(pre): shadow-utils %description cgi This package includes CGI programs for accessing UPS status via a web browser. -%package monitor -Summary: Network UPS Tools monitor application -BuildRequires: python3-pyqt6 - -%description monitor -This package contain the Python NUT-Monitor GUI application to -monitor a UPS. - %package xml Summary: XML UPS driver for the Network UPS Tools Requires: %{name}-client = %{version}-%{release} @@ -135,32 +134,25 @@ necessary to develop NUT client applications. %prep %setup -q -#patch -P 2 -p1 -b .piddir-owner -%patch -P 9 -p1 -b .rmpidf -#patch -P 15 -p1 -%patch -P 16 -p2 -b .rhinoname +#patch0 -p1 -b .openssl +%patch1 -p1 -b .tmpfiles +#patch5 -p1 -b .dlfix +#%patch7 -p1 -b .foreground +%patch8 -p1 -b .unreachable +%patch9 -p1 -b .rmpidf +#%patch10 -p1 -b .cloexec +#%patch11 -p1 -b .nutscanner-FTBFS +#%patch12 -p1 -b .scratchdes +sed -i 's|=NUT-Monitor|=nut-monitor|' scripts/python/app/nut-monitor-py3qt5.desktop +sed -i "s|sys.argv\[0\]|'%{_datadir}/%{name}/nut-monitor/nut-monitor'|" scripts/python/app/NUT-Monitor-py3qt5.in sed -i 's|LIBSSL_LDFLAGS|LIBSSL_LIBS|' lib/libupsclient-config.in sed -i 's|LIBSSL_LDFLAGS|LIBSSL_LIBS|' lib/libupsclient.pc.in # workaround for multilib conflicts - caused by patch changing modification time of scripts find . -mtime -1 -print0 | xargs -0 touch --reference %{SOURCE0} -# fix python site packages check -sed -i 's|\(PYTHON3\?_SITE_PACKAGES=\)".*"|\1"%{python3_sitelib}"|' m4/nut_check_python.m4 - -# Create a sysusers.d config file -cat >nut.sysusers.conf <>include/config.h #remove rpath @@ -218,7 +203,11 @@ mkdir -p %{buildroot}%{modeldir} \ %make_install -#mv %{buildroot}%{_tmpfilesdir}/nut-common.tmpfiles %{buildroot}%{_tmpfilesdir}/nut-common.conf +#if 0%{?fedora} || 0%{?rhel} > 6 +# install -p -D -m 644 %{SOURCE3} %{buildroot}%{_tmpfilesdir}/nut-client.conf +#endif + +mv %{buildroot}%{_tmpfilesdir}/nut-common.tmpfiles %{buildroot}%{_tmpfilesdir}/nut-common.conf rm -rf %{buildroot}%{_prefix}/html rm -f %{buildroot}%{_libdir}/*.la @@ -226,7 +215,7 @@ rm -rf docs/man rm -rf %{buildroot}%{_datadir}/nut/solaris-init find docs/ -name 'Makefile*' -delete -pushd conf; +pushd conf; %make_install for file in %{buildroot}%{_sysconfdir}/ups/*.sample do @@ -246,119 +235,107 @@ do mv -f $fe.new $fe done -# rename rhino to nutdrv_rhino to prevent file conflict (rhbz#2367057) -mv %{buildroot}%{_mandir}/man8/rhino.8 %{buildroot}%{_mandir}/man8/nutdrv_rhino.8 - -# install PyNUT +# install PyNUT install -p -D -m 644 scripts/python/module/PyNUT.py %{buildroot}%{python3_sitelib}/PyNUT.py -# add lowercase name -ln %{buildroot}%{_bindir}/{NUT-Monitor,nut-monitor} -# install desktop file -mkdir -p %{buildroot}%{_datadir}/applications -desktop-file-install \ - --dir=%{buildroot}%{_datadir}/applications \ - %{buildroot}%{_datadir}/nut-monitor/app/nut-monitor.desktop -# install icons -for res in 256x256 48x48 64x64 scalable -do - mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${res}/apps - ln %{buildroot}%{_datadir}/nut-monitor/app/icons/${res}/nut-monitor.* \ - %{buildroot}%{_datadir}/icons/hicolor/${res}/apps/ -done - -# Setup permissions for pid file -touch %{buildroot}/%{piddir}/upsmon.pid -chmod 0644 %{buildroot}/%{piddir}/upsmon.pid - -install -m0644 -D nut.sysusers.conf %{buildroot}%{_sysusersdir}/nut.conf +# install nut-monitor +%if %{with python2} +mkdir -p %{buildroot}%{_datadir}/nut/nut-monitor/pixmaps +install -p -m 755 scripts/python/app/NUT-Monitor %{buildroot}%{_datadir}/nut/nut-monitor/nut-monitor +install -p -m 644 scripts/python/app/gui-1.3.glade %{buildroot}%{_datadir}/nut/nut-monitor +install -p -m 644 scripts/python/app/pixmaps/* %{buildroot}%{_datadir}/nut/nut-monitor/pixmaps/ +install -p -D scripts/python/app/nut-monitor.png %{buildroot}%{_datadir}/pixmaps/nut-monitor.png +desktop-file-install --dir=%{buildroot}%{_datadir}/applications scripts/python/app/nut-monitor.desktop +ln -s %{_datadir}/nut/nut-monitor/nut-monitor %{buildroot}%{_bindir}/nut-monitor +%endif %pre +/usr/sbin/useradd -c "Network UPS Tools" -u %{nut_uid} \ + -s /bin/false -r -d %{_localstatedir}/lib/ups %{name} 2> /dev/null || : +/usr/sbin/usermod -G dialout,tty %{name} + # do not let upsmon run during upgrade rhbz#916472 # phase 1: stop upsmon before upsd changes if [ "$1" = "2" ]; then rm -f %restart_flag - /bin/systemctl is-active nut-monitor.service >/dev/null 2>&1 && touch %restart_flag || : - /bin/systemctl stop nut-monitor.service >/dev/null 2>&1 || : + /bin/systemctl is-active nut-monitor.service >/dev/null 2>&1 && touch %restart_flag ||: + /bin/systemctl stop nut-monitor.service >/dev/null 2>&1 fi %post -%systemd_post nut-driver-enumerator.path nut-driver-enumerator.service nut-driver.target nut-server.service nut.target +/sbin/ldconfig +%systemd_post nut-driver.service nut-server.service %preun -%systemd_preun nut-driver-enumerator.path nut-driver-enumerator.service nut-driver.target nut-server.service nut.target +%systemd_preun nut-driver.service nut-server.service -%postun -%systemd_postun_with_restart nut-driver.target nut-server.service +%postun +/sbin/ldconfig +%systemd_postun_with_restart nut-driver.service nut-server.service +%pre client +/usr/sbin/useradd -c "Network UPS Tools" -u %{nut_uid} \ + -s /bin/false -r -d %{_localstatedir}/lib/ups %{name} 2> /dev/null || : +/usr/sbin/usermod -G dialout,tty %{name} +%pre cgi +/usr/sbin/useradd -c "Network UPS Tools" -u %{nut_uid} \ + -s /bin/false -r -d %{_localstatedir}/lib/ups %{name} 2> /dev/null || : +/usr/sbin/usermod -G dialout,tty %{name} %post client -%systemd_post nut-monitor.service nut.target +/sbin/ldconfig +%systemd_post nut-monitor.service %preun client -%systemd_preun nut-monitor.service nut.target +%systemd_preun nut-monitor.service %postun client +/sbin/ldconfig %systemd_postun_with_restart nut-monitor.service %posttrans # phase 2: start upsmon again -if [ -e %restart_flag ]; then - /bin/systemctl restart nut-monitor.service >/dev/null 2>&1 || : - rm -f %restart_flag +if [ -e %restart_flag ]; then + /bin/systemctl restart nut-monitor.service >/dev/null 2>&1 || : + rm -f %restart_flag else # maybe we did not stop it - if we reinstalled just nut-client - /bin/systemctl try-restart nut-monitor.service >/dev/null 2>&1 || : -fi + /bin/systemctl try-restart nut-monitor.service >/dev/null 2>&1 || : +fi %files %license COPYING LICENSE-GPL2 LICENSE-GPL3 -%doc ChangeLog AUTHORS MAINTAINERS README docs INSTALL NEWS +%doc ChangeLog AUTHORS MAINTAINERS README docs UPGRADING INSTALL NEWS +%config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/nut.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/ups.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsd.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsd.users %attr(644,root,root) %{_usr}/lib/udev/rules.d/62-nut-usbups.rules %attr(644,root,root) %{_usr}/lib/udev/rules.d/62-nut-ipmipsu.rules -%{modeldir}/ -# dummy-ups requires libupsclient -%exclude %{modeldir}/dummy-ups +%{modeldir}/* %exclude %{modeldir}/netxml-ups %{_unitdir}/nut-driver-enumerator.path %{_unitdir}/nut-driver-enumerator.service -%{_unitdir}/nut-driver-enumerator-daemon-activator.path -%{_unitdir}/nut-driver-enumerator-daemon-activator.service -%{_unitdir}/nut-driver-enumerator-daemon.service %{_unitdir}/nut-driver@.service %{_unitdir}/nut-driver.target %{_unitdir}/nut-server.service %{_unitdir}/nut.target -%{_presetdir}/nut-systemd.preset -%{_unitdir}/enphase-monitor@.service -%{_unitdir}/nut-logger.service -%{_unitdir}/nut-udev-settle.service %{_sbindir}/upsd -%{_bindir}/nutconf %{_bindir}/nut-scanner -%{_sbindir}/upsdrvctl -%{_sbindir}/upsdrvsvcctl +%{_bindir}/upslog %{_libdir}/libnutscan.so.* -%{_libdir}/libnutconf.so.* %{_libexecdir}/nut-driver-enumerator.sh -%{_libexecdir}/sockdebug -%{_libexecdir}/enphase-monitor %{_datadir}/augeas/lenses/dist/nut* -%{_datadir}/augeas/lenses/dist/tests/test_nut.aug %{_datadir}/%{name}/cmdvartab %{_datadir}/%{name}/driver.list +%{_mandir}/man5/nut.conf.5.gz %{_mandir}/man5/ups.conf.5.gz %{_mandir}/man5/upsd.conf.5.gz %{_mandir}/man5/upsd.users.5.gz -%{_mandir}/man8/nutconf.8.gz - %{_mandir}/man8/adelsystem_cbi.8.gz -%{_mandir}/man8/apc_modbus.8.gz + %{_mandir}/man8/al175.8.gz %{_mandir}/man8/apcsmart.8.gz @@ -373,38 +350,28 @@ fi %{_mandir}/man8/bestfortress.8.gz %{_mandir}/man8/bestups.8.gz %{_mandir}/man8/bestuferrups.8.gz -%{_mandir}/man8/bicker_ser.8.gz %{_mandir}/man8/blazer_ser.8.gz %{_mandir}/man8/blazer_usb.8.gz %{_mandir}/man8/clone.8.gz -%{_mandir}/man8/clone-outlet.8.gz %{_mandir}/man8/dummy-ups.8.gz %{_mandir}/man8/everups.8.gz %{_mandir}/man8/etapro.8.gz -%{_mandir}/man8/failover.8.gz %{_mandir}/man8/gamatronic.8.gz %{_mandir}/man8/generic_modbus.8.gz %{_mandir}/man8/genericups.8.gz -%if 0%{?fedora} < 39 -%{_mandir}/man8/generic_gpio.8.gz -%endif -%{_mandir}/man8/hwmon_ina219.8.gz %{_mandir}/man8/huawei-ups2000.8.gz %{_mandir}/man8/isbmex.8.gz %{_mandir}/man8/ivtscd.8.gz %{_mandir}/man8/liebert.8.gz %{_mandir}/man8/liebert-esp2.8.gz -%{_mandir}/man8/liebert-gxe.8.gz %{_mandir}/man8/masterguard.8.gz %{_mandir}/man8/metasys.8.gz %{_mandir}/man8/microdowell.8.gz %{_mandir}/man8/microsol-apc.8.gz %{_mandir}/man8/mge-utalk.8.gz %{_mandir}/man8/mge-shut.8.gz -%{_mandir}/man8/nhs_ser.8.gz %{_mandir}/man8/nutupsdrv.8.gz %{_mandir}/man8/nutdrv_atcl_usb.8.gz -%{_mandir}/man8/nutdrv_hashx.8.gz %{_mandir}/man8/nutdrv_siemens_sitop.8.gz %{_mandir}/man8/nut-driver-enumerator.8.gz %{_mandir}/man8/nut-ipmipsu.8.gz @@ -420,80 +387,60 @@ fi %{_mandir}/man8/powerman-pdu.8.gz %endif %{_mandir}/man8/powerpanel.8.gz -%{_mandir}/man8/powervar_cx_ser.8.gz -%{_mandir}/man8/powervar_cx_usb.8.gz -%{_mandir}/man8/nutdrv_rhino.8.gz +%{_mandir}/man8/rhino.8.gz %{_mandir}/man8/richcomm_usb.8.gz %{_mandir}/man8/riello_ser.8.gz %{_mandir}/man8/riello_usb.8.gz %{_mandir}/man8/safenet.8.gz -%{_mandir}/man8/sms_ser.8.gz %{_mandir}/man8/snmp-ups.8.gz %{_mandir}/man8/solis.8* -%{_mandir}/man8/sockdebug.8.gz %{_mandir}/man8/socomec_jbus.8.gz %{_mandir}/man8/tripplite.8.gz %{_mandir}/man8/tripplite_usb.8.gz %{_mandir}/man8/tripplitesu.8.gz +%{_mandir}/man8/victronups.8.gz %{_mandir}/man8/upscode2.8* %{_mandir}/man8/upsd.8.gz %{_mandir}/man8/upsdrvctl.8.gz %{_mandir}/man8/upsdrvsvcctl.8.gz +%{_mandir}/man8/upslog.8.gz %{_mandir}/man8/usbhid-ups.8.gz -%{_mandir}/man8/victronups.8.gz -%{_mandir}/man8/ve-direct.8.gz -%{_sysusersdir}/nut.conf %files client %license COPYING LICENSE-GPL2 LICENSE-GPL3 %dir %{_sysconfdir}/ups -%config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/nut.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upsmon.conf %config(noreplace) %attr(640,root,nut) %{_sysconfdir}/ups/upssched.conf -%{_tmpfilesdir}/nut-common-tmpfiles.conf +#{_tmpfilesdir}/nut-client.conf +%{_tmpfilesdir}/nut-common.conf %dir %attr(750,nut,nut) %{_localstatedir}/lib/ups # upsmon.pid is written as root, so root needs access for now -%dir %attr(770,root,dialout) %{piddir} -%attr(644,nut,nut) %verify(not size mtime md5) /run/%{name}/upsmon.pid +%ghost %attr(770,root,nut) %{piddir} %{_bindir}/upsc %{_bindir}/upscmd -%{_bindir}/upslog %{_bindir}/upsrw %{_sbindir}/upsmon %{_sbindir}/upssched %{_bindir}/upssched-cmd -# dummy-ups requires libupsclient -%{modeldir}/dummy-ups %{_unitdir}/nut-monitor.service -# nut-monitor.service also needs nut.target -%{_unitdir}/nut.target /lib/systemd/system-shutdown/nutshutdown %{_libdir}/libupsclient.so.* %{_libdir}/libnutclient.so.* %{_libdir}/libnutclientstub.so.* -%{_mandir}/man5/nut.conf.5.gz %{_mandir}/man5/upsmon.conf.5.gz %{_mandir}/man5/upssched.conf.5.gz -%{_mandir}/man7/nut.7.gz %{_mandir}/man8/upsc.8.gz %{_mandir}/man8/upscmd.8.gz -%{_mandir}/man8/upslog.8.gz %{_mandir}/man8/upsrw.8.gz %{_mandir}/man8/upsmon.8.gz %{_mandir}/man8/upssched.8.gz -%{_datadir}/nut -%{_sysusersdir}/nut.conf - -%files monitor -%{_bindir}/nut-monitor -%{_bindir}/NUT-Monitor -%{_datadir}/applications/nut-monitor.desktop -%{_datadir}/icons/hicolor/*/apps/nut-monitor.png -%{_datadir}/icons/hicolor/scalable/apps/nut-monitor.svg -%{_datadir}/nut-monitor/ -%{_mandir}/man8/NUT-Monitor*.8.gz %pycached %{python3_sitelib}/PyNUT.py -%pycached %{python3_sitelib}/test_nutclient.py +%{_datadir}/nut +%if %{with python2} +%{_bindir}/nut-monitor +%{_datadir}/pixmaps/nut-monitor.png +%{_datadir}/applications/nut-monitor.desktop +%endif %files cgi %config(noreplace) %attr(644,root,root) %{_sysconfdir}/ups/hosts.conf @@ -521,111 +468,13 @@ fi %{_libdir}/libupsclient.so %{_libdir}/libnutclient.so %{_libdir}/libnutclientstub.so -%{_libdir}/libnutconf.so %{_libdir}/libnutscan.so %{_libdir}/pkgconfig/libupsclient.pc %{_libdir}/pkgconfig/libnutclient.pc -%{_libdir}/pkgconfig/libnutconf.pc %{_libdir}/pkgconfig/libnutclientstub.pc %{_libdir}/pkgconfig/libnutscan.pc %changelog -* Sat Dec 06 2025 Orion Poplawski - 2.8.4-5 -- Add missing || : to preinstall scriptlet (rhbz#2419644) - -* Tue Sep 30 2025 Michal Hlavinka - 2.8.4-4 -- 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 - -* Fri Sep 19 2025 Python Maint - 2.8.4-3 -- Rebuilt for Python 3.14.0rc3 bytecode - -* Fri Aug 15 2025 Python Maint - 2.8.4-2 -- Rebuilt for Python 3.14.0rc2 bytecode - -* Thu Aug 14 2025 Michal Hlavinka - 2.8.4-1 -- updated to 2.8.4 (#2387244) - -* Thu Jul 24 2025 Fedora Release Engineering - 2.8.3-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Mon Jun 02 2025 Python Maint - 2.8.3-3 -- Rebuilt for Python 3.14 - -* Wed May 21 2025 Michal Hlavinka - 2.8.3-2 -- rename rhino to nutdrv_rhino to prevent file conflict (rhbz#2367057) - -* Tue Apr 29 2025 Michal Hlavinka - 2.8.3-1 -- updated to 2.8.3 (#2352734) - -* Tue Feb 11 2025 Zbigniew Jędrzejewski-Szmek - 2.8.2.1-5.1.git20240703pr2505 -- Add sysusers.d config file to allow rpm to create users/groups automatically - -* Wed Jan 29 2025 Michal Hlavinka - 2.8.2.1-4.1.git20240703pr2505 -- fix ftbfs, make it build with unified bin/sbin - -* Fri Jan 17 2025 Fedora Release Engineering - 2.8.2.1-3.1.git20240703pr2505 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Fri Nov 15 2024 Orion Poplawski - 2.8.2.1-2.1.git20240703pr2505 -- Add BR systemd-devel to enable systemd notification support - -* Thu Jul 18 2024 Fedora Release Engineering - 2.8.2.1-1.1.git20240703pr2505 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Wed Jul 03 2024 Michal Hlavinka - 2.8.2.1-0.1.git20240703pr2505 -- fix python FTBFS, uses git snapshot as of 20240703 with PR 2505 - -* Fri Jun 07 2024 Python Maint - 2.8.2-2 -- Rebuilt for Python 3.13 - -* Wed Apr 03 2024 Michal Hlavinka - 2.8.2-1 -- updated to 2.8.2(2272586) - -* Thu Jan 25 2024 Fedora Release Engineering - 2.8.1-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sun Jan 21 2024 Fedora Release Engineering - 2.8.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Thu Nov 30 2023 Orion Poplawski - 2.8.1-2 -- Re-add nut.target to nut-client (bz#2156504) - -* Wed Nov 01 2023 Michal Hlavinka - 2.8.1-1 -- updated to 2.8.1 (#2247337) - -* Tue Oct 10 2023 Michal Hlavinka - 2.8.0-14 -- spec cleanup, based on PR#14 by Orion Poplawski - -* Thu Jul 20 2023 Fedora Release Engineering - 2.8.0-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Tue Jun 13 2023 Python Maint - 2.8.0-12 -- Rebuilt for Python 3.12 - -* Wed Apr 26 2023 Michal Hlavinka - 2.8.0-11 -- update license tag format (SPDX migration) for https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1 - -* Tue Feb 14 2023 Michal Hlavinka - 2.8.0-10 -- add nut-xml to nut recommends (#2151810) - -* Thu Jan 19 2023 Fedora Release Engineering - 2.8.0-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Wed Jan 04 2023 Michal Hlavinka - 2.8.0-8 -- move upslog to nut-client, some small spec file changes (#2156504) - -* Wed Nov 30 2022 Charles R. Anderson - 2.8.0-7 -- 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 - -* Sun Nov 27 2022 Florian Weimer - 2.8.0-6 -- Port configure script to C99 - * Wed Aug 31 2022 Michal Hlavinka - 2.8.0-5 - update pid path @@ -858,3 +707,499 @@ fi * Mon Jan 07 2013 Michal Hlavinka - 2.6.5-8 - do not traceback when ups is not reachable +* Fri Dec 21 2012 Adam Tkac - 2.6.5-7 +- rebuild against new libjpeg + +* Fri Sep 14 2012 Michal Hlavinka - 2.6.5-6 +- use new systemd macros (#857416) + +* Tue Sep 11 2012 Michal Hlavinka - 2.6.5-5 +- add support for foreground mode + +* Tue Sep 11 2012 Michal Hlavinka - 2.6.5-4 +- do not forget to restart nut-driver.service in postun + +* Thu Sep 06 2012 Michal Hlavinka - 2.6.5-3 +- do not depend on devel files (#838139) + +* Mon Sep 03 2012 Michal Hlavinka - 2.6.5-2 +- rebuilt with updated freeipmi + +* Fri Aug 10 2012 Michal Hlavinka - 2.6.5-1 +- nut updated to 2.6.5 + +* Fri Jul 20 2012 Fedora Release Engineering - 2.6.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Thu Jun 14 2012 Michal Hlavinka - 2.6.4-1 +- nut updated to 2.6.4 + +* Thu May 31 2012 Michal Hlavinka - 2.6.3-4 +- fix heap-based buffer overflow due improper processing of non-printable + characters in random network data (CVE-2012-2944) + +* Mon May 28 2012 Michal Hlavinka - 2.6.3-3 +- bump release nubmer to fix upgrade path + +* Mon Apr 16 2012 Michal Hlavinka - 2.6.3-2 +- do not forget to create /var/run/nut before starting service (#812825) + +* Thu Jan 05 2012 Michal Hlavinka - 2.6.3-1 +- nut updated to 2.6.3 + +* Tue Dec 06 2011 Adam Jackson - 2.6.2-2 +- Rebuild for new libpng + +* Fri Sep 16 2011 Michal Hlavinka - 2.6.2-1 +- nut updated to 2.6.2 + +* Tue Aug 16 2011 Michal Hlavinka - 2.6.1-4 +- update requirements of packages + +* Fri Jul 22 2011 Michal Hlavinka - 2.6.1-3 +- add initial support for systemd + +* Fri Jul 08 2011 Michal Hlavinka - 2.6.1-2 +- rebuilt for net-snmp update + +* Tue Jun 07 2011 Michal Hlavinka - 2.6.1-1 +- nut updated to 2.6.1 + +* Thu Apr 21 2011 Michal Hlavinka - 2.6.0-8 +- fix usb report reading (#698512) + +* Thu Apr 21 2011 Michal Hlavinka - 2.6.0-7 +- nut-hal should be obsoleted to prevent broken dependency in yum + +* Wed Apr 20 2011 Michal Hlavinka - 2.6.0-6 +- standard dependency adds udev, but we need it for %%pre script + +* Wed Apr 20 2011 Michal Hlavinka - 2.6.0-5 +- drop hal support, it was removed from rawhide + +* Mon Mar 28 2011 Michal Hlavinka - 2.6.0-4 +- fix list of ssl libraries in libupsclient.pc + +* Mon Feb 21 2011 Michal Hlavinka - 2.6.0-3 +- add nut-monitor (gui) to client sub-package + +* Tue Feb 08 2011 Fedora Release Engineering - 2.6.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 17 2011 Michal Hlavinka - 2.6.0-1 +- nut updated to 2.6.0 +- fixed reading of reports bigger than 8 bytes + +* Fri Nov 26 2010 Michal Hlavinka - 2.4.3-9 +- use %%ghost for /var/run/nut (#656645) + +* Fri Nov 05 2010 Michal Hlavinka - 2.4.3-8 +- rebuild because libraries were updated + +* Wed Sep 29 2010 jkeating - 2.4.3-7 +- Rebuilt for gcc bug 634757 + +* Fri Sep 17 2010 Michal Hlavinka - 2.4.3-6 +- fix inconsitent name of upsdrvctl in init script (#633116) + +* Mon Jul 26 2010 Michal Hlavinka - 2.4.3-5 +- fix crash when port= is ommited (#616375) +- fix issue where nut fails to restart because it did not finished termination + yet and old instance blocks devices (#193058) + +* Wed Jul 07 2010 Michal Hlavinka - 2.4.3-4 +- follow licensing guideline update + +* Fri Mar 26 2010 Michal Hlavinka - 2.4.3-3 +- replace BUS with SUBSYSTEMS in udev rules (#573806) + +* Tue Mar 23 2010 Michal Hlavinka - 2.4.3-2 +- reduced size of buffer to maximum size supported by low-speed USB devices +- fixes #575334 + +* Wed Feb 24 2010 Michal Hlavinka - 2.4.3-1 +- cyberpower driver was replaced by the powerpanel driver +- general USB support has been vastly improved, including many bug + fixes, new features and devices +- the virtual driver has been renamed to 'clone' +- the UPower (previously known as DeviceKit-power) rules file is now + generated by NUT +- a lot of new devices supported + +* Thu Nov 05 2009 Michal Hlavinka - 2.4.1-9 +- spec cleanup + +* Fri Aug 21 2009 Tomas Mraz - 2.4.1-8 +- rebuilt with new openssl + +* Sat Jul 25 2009 Fedora Release Engineering - 2.4.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed May 20 2009 Michal Hlavinka - 2.4.1-6 +- fix coexistence with virtualbox (#488368) + +* Wed May 20 2009 Michal Hlavinka - 2.4.1-5 +- add requires for hal (#501687) + +* Fri Apr 17 2009 Michal Hlavinka - 2.4.1-4 +- change group even for existing nut user (#495999) + +* Tue Apr 14 2009 Michal Hlavinka - 2.4.1-3 +- udev changed group from uucp to dialout, follow the change (#494020) + +* Wed Feb 25 2009 Fedora Release Engineering - 2.4.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Feb 17 2009 Michal Hlavinka 2.4.1-1 +- update to 2.4.1 +- added support for microdowell ups + +* Mon Feb 16 2009 Michal Hlavinka 2.4.0-1 +- update to new stable branch 2.4 + +* Sat Jan 17 2009 Tomas Mraz 2.2.2-6 +- rebuild with new openssl + +* Thu Dec 18 2008 Michal Hlavinka 2.2.2-5 +- remove rpath, fix libtool + +* Wed Dec 17 2008 Michal Hlavinka 2.2.2-4 +- fix #476850 - tripplite_usb driver segfaults when UPS on battery + +* Mon Sep 15 2008 Tomas Smetana 2.2.2-3 +- fix #461374 - add missing udev rules + +* Mon Aug 25 2008 Tomas Smetana 2.2.2-2 +- fix requirements in spec file +- build a separate hal package + +* Mon May 12 2008 Tomas Smetana 2.2.2-1 +- new upstream version + +* Tue Feb 12 2008 Tomas Smetana 2.2.1-3 +- fix compilation error with new glibc headers + +* Tue Feb 12 2008 Tomas Smetana 2.2.1-2 +- rebuild (gcc-4.3) + +* Wed Jan 09 2008 Tomas Smetana 2.2.1-1 +- new upstream version + +* Wed Dec 05 2007 Tomas Smetana 2.2.0-6.2 +- rebuild + +* Thu Nov 29 2007 Tomas Smetana 2.2.0-6.1 +- init script update, fix a typo + +* Wed Nov 28 2007 Tomas Smetana 2.2.0-6 +- fix forgotten bug in init script +- do not hardcode the uucp group in udev patch + +* Tue Nov 27 2007 Tomas Smetana 2.2.0-5 +- fix udev rules and hal information files +- fix init script + +* Wed Sep 19 2007 Tomas Smetana 2.2.0-4 +- fix manpages encodings +- run ldconfig after client (un)install +- fix HAL support + +* Thu Sep 06 2007 Tomas Smetana 2.2.0-3 +- fix wrong libssl flags in devel, fix devel package dependencies + +* Wed Aug 15 2007 Tomas Smetana 2.2.0-2 +- fix #249028 - usb udev rules +- update initscript and sysconfig file +- fix calls to open() for compatibility with the new glibc + +* Fri Jul 13 2007 Tomas Smetana 2.2.0-1.1 +- rebuild + +* Fri Jul 13 2007 Tomas Smetana 2.2.0-1 +- new upstream version (Resolves: #248074) +- initscripts update +- spec file cleanup + +* Mon May 07 2007 Arnaud Quette 2.1.0-1 +- update to 2.1.0 development tree +- HAL, ... + +* Mon Mar 26 2007 Than Ngo 2.0.5-3 +- cleanup + +* Tue Jan 23 2007 Karsten Hopp 2.0.5-2 +- rename fatal to fatal_with_errno in ipv6 patch +- fix filelist + +* Tue Jan 23 2007 Karsten Hopp 2.0.5-1 +- update to 2.0.5 + +* Wed Nov 29 2006 Karsten Hopp 2.0.4-2 +- rebuild with new net-snmp-libs +- disable nut-2.0.1-bad.patch, not required + +* Tue Nov 21 2006 Than Ngo - 2.0.4-1 +- add IPv6 support, thanks to Dan KopeÄek (#198394) + +* Wed Jul 12 2006 Jesse Keating - 2.0.3-2.1 +- rebuild + +* Tue May 16 2006 Than Ngo 2.0.3-2 +- fix #191914, BR fontconfig-devel for cgi + +* Mon Apr 24 2006 Than Ngo 2.0.3-1 +- update to 2.0.3 +- drop nut-2.0.2-buffer.patch, it's included in new upstream +- add udev rule #189674, #187105 + +* Fri Feb 10 2006 Jesse Keating - 2.0.2-6.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 2.0.2-6.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Tue Jan 03 2006 Radek Vokal 2.0.2-6 +- rebuilt against new libnetsnmp + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Wed Nov 23 2005 Than Ngo 2.0.2-5 +- fix for modular X + +* Wed Nov 09 2005 Than Ngo 2.0.2-4 +- rebuilt + +* Mon Nov 07 2005 Than Ngo 2.0.2-3 +- rebuilt + +* Thu Nov 03 2005 Than Ngo 2.0.2-2 +- rebuilt against new libnetsnmp + +* Wed Jul 20 2005 Than Ngo 2.0.2-1 +- fix compiler warnings #156027 +- fix pid issue #159450 +- fix wrong ownership and permissions #159449, #141123 +- update to 2.0.2 + +* Thu Mar 10 2005 Than Ngo 2.0.1-1 +- 2.0.1 +- fix uninit local variable, #131773 + +* Wed Dec 08 2004 Than Ngo 2.0.0-7 +- don't requires libusb-devel on s390/s390x +- add %%{release} in buildroot + +* Thu Nov 25 2004 Miloslav Trmac - 2.0.0-6 +- Convert newhidups.8 to UTF-8 + +* Tue Oct 05 2004 Than Ngo 2.0.0-5 +- more buildrequires +- don't build on s390/s390x + +* Thu Aug 26 2004 Nalin Dahyabhai 2.0.0-4 +- fix syntax error in -client postun scriptlet (#131040) + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Mon May 10 2004 Than Ngo 2.0.0-2 +- fixed permission problem, bug #122867 + +* Fri Apr 02 2004 Than Ngo 2.0.0-1 +- 2.0.0 + +* Sat Feb 14 2004 Than Ngo 1.4.1-3 +- add some missing drivers + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Wed Feb 11 2004 Than Ngo 1.4.1-1 +- 1.4.1 +- fixed permission problem (bug #115290) + +* Wed Sep 24 2003 Mike McLean 1.4.0-3 +- fixed 'nut' user problem with nut-cgi (bug#104872) + +* Mon Sep 15 2003 Than Ngo 1.4.0-2 +- added missing hidups driver (bug #104412) + +* Tue Sep 09 2003 Than Ngo 1.4.0-1 +- 1.4.0 +- fixed permission problem (bug #103023) +- fixed rpm file list (bug #90848) +- added support multiple drivers, thanks to Gilbert E. Detillieux (bug #79465) + +* Thu Jun 26 2003 Than Ngo 1.2.2-3 +- Add variable to ups sysconfig file for upsd (bug #97900) + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed May 7 2003 Than Ngo 1.2.2-1 +- 1.2.2 + +* Tue May 06 2003 Phil Knirsch 1.2.0-7 +- Bumped release and rebuilt because of new gd version. + +* Thu Feb 13 2003 Than Ngo 1.2.0-6 +- build with correct userid #84199 +- fix directory permission + +* Tue Feb 11 2003 Than Ngo 1.2.0-5 +- add user nut, bug #81500 +- fix permission issue, bug #81524, #83997 +- own /etc/ups, bug #73959 + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Wed Jan 8 2003 Thomas Woerner 1.2.0-3 +- added html templates for cgi scripts (#78532) +- added hidups driver (#80334) + +* Wed Dec 18 2002 Dan Walsh 1.2.0-2 +- Fix service description + +* Wed Nov 6 2002 han Ngo 1.2.0-1 +- update to 1.2.0 + +* Mon Nov 4 2002 Than Ngo 1.00-1 +- update to 1.00 + +* Wed Jul 31 2002 Than Ngo 0.45.4-5 +- Fixed wrong CMDSCRIPT (bug #69817) + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Sun Jun 02 2002 Than Ngo 0.45.4-3 +- fix forced shutdown (bug #65824, #60516) +- enable hidups driver +- add missing manages (bug #65188) + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Tue Feb 26 2002 Than Ngo 0.45.4-1 +- update to 0.45.4 + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Fri Dec 14 2001 Than Ngo 0.45.3-1 +- update to 0.45.2 +- fix bug #57417 + +* Tue Nov 27 2001 Than Ngo 0.45.2-1 +- update to 0.45.2 +- clean up some patch files for 0.45.2 + +* Tue Jul 24 2001 Than Ngo 0.45.0-3 +- fix build dependencies (bug #49858) + +* Fri Jul 6 2001 Than Ngo 0.45.0-2 +- rebuild + +* Wed Jun 13 2001 Than Ngo +- update to 0.45.0 +- add some patches from alane@geeksrus.net (bug #44361, #44363) + +* Sun Apr 22 2001 Than Ngo +- add all available UPS drivers (Bug #36937) + +* Fri Apr 13 2001 Than Ngo +- update to 0.44.3 (Bug #35255) + +* Fri Feb 9 2001 Than Ngo +- fixed typo (Bug #26535) + +* Tue Feb 6 2001 Trond Eivind Glomsrd +- Fix some of the i18n +- make it exit cleanly if not configured + +* Fri Jan 26 2001 Than Ngo +- initscript internationalisation + +* Thu Jan 11 2001 Than Ngo +- fixed init script error (bug #23525) + +* Sat Oct 21 2000 Than Ngo +- update to 0.44.1 + +* Tue Aug 01 2000 Than Ngo +- rebuilt with Michael changes + +* Mon Jul 31 2000 Michael Stefaniuc +- changed /etc/sysconfig/ups to adress the changes in 0.44.0 +- moved /etc/sysconfig/ups to the server package +- changed the initscript +- small config file patch + +* Fri Jul 28 2000 Than Ngo +- fixed initscripts so that condrestart doesn't return 1 when the test fails + +* Mon Jul 24 2000 Than Ngo +- nut CGIs is disable as default (Bug #14282) + +* Tue Jul 18 2000 Than Ngo +- update to 0.44.0 +- inits back to rc.d/init.d, using service to fire them up + +* Wed Jul 12 2000 Than Ngo +- fix initscript and specfile, it should work with 6.x and 7.x +- add --with-statepath and --sysconfdir to %%configure (thanks Michael) + +* Sat Jul 08 2000 Than Ngo +- add Prereq: /etc/init.d + +* Tue Jun 27 2000 Than Ngo +- don't prereq, only require initscripts + +* Mon Jun 26 2000 Than Ngo +- /etc/rc.d/init.d -> /etc/init.d +- prereq initscripts >= 5.20 + +* Fri Jun 16 2000 Bill Nottingham +- don't run by default + +* Mon Jun 12 2000 Preston Brown +- adopted for Winston. Use our new path macros. +- change nocgi pkg to a cgi pkg (inclusive rather than exclusive). +- new init script + +* Sat May 06 2000 (0.43.2-1) +- Updated Package to new release + +* Thu Jan 20 2000 (0.42.2-1) +- Updated package to new release +- Dropped bestups patch since that is fixed in 0.42.2 + +* Sat Dec 18 1999 (0.42.1-4) +- Package now uses chkconfig + +* Sat Dec 18 1999 (0.42.1-3) +- applied an improved patch to deal with the + bestups string length issue. + +* Sat Dec 11 1999 (0.42.1-1) +- fixed string length in bestups.c line 279. +- upgraded package to 0.42.1 from 0.42.0 + +* Mon Dec 6 1999 (0.42.0-8) +- added requirement of nut-client for nut. + +* Mon Dec 6 1999 (0.42.0-7) +- removed overlapping files between the nut and nut-client rpms + +* Tue Nov 23 1999 (0.42.0-6) +- stop ups before uninstalling + +* Tue Nov 23 1999 (0.42.0-5) +- build against gd 1.6.3 + +* Wed Nov 03 1999 (0.42.0-4) +- Initial build of nut (well almost). +- Removed chmod from the make file so that the package + does not have to be built as root..... diff --git a/sources b/sources index 5f00a02..3574636 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nut-2.8.4.tar.gz) = 0d87c0006608f92ae54f8a500f93d9a81eac1d9abf57f32e7718dd72f265b8293a0b6cdba04c802b81eaf8907b52669c36b47b6875a4377f9752845ac6c5e8fa +SHA512 (nut-2.8.0.tar.gz) = 3c413ae54088045a713eb80cf1bdda474f41bb3b67c7c0248aa7a0c4d441dce1ff42627a2735273d7e36892d1f2eeb895220cf28af63fec2fa0c7a267f82d577 diff --git a/ups.init b/ups.init new file mode 100644 index 0000000..fab3c92 --- /dev/null +++ b/ups.init @@ -0,0 +1,147 @@ +#! /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 diff --git a/ups.sysconfig b/ups.sysconfig new file mode 100644 index 0000000..58f4f28 --- /dev/null +++ b/ups.sysconfig @@ -0,0 +1,8 @@ +# 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]