Compare commits

..

16 commits

Author SHA1 Message Date
Michal Hlavinka
65e797e06e updated to 2.8.2 2024-11-27 12:44:49 +01:00
Michal Hlavinka
5e78cbec8b fix tmpfiles path in unit file (#2227107) 2023-11-29 10:36:24 +01:00
Michal Hlavinka
af7c7cf0e9 Merge branch 'epel8' into epel9 2023-02-14 21:31:31 +01:00
Michal Hlavinka
f37cf7411e add nut-xml to nut recommends (#1379382) 2023-02-14 21:13:52 +01:00
Michal Hlavinka
a686358628 Merge branch 'epel8' into epel9 2022-12-12 23:15:32 +01:00
Michal Hlavinka
b761a2932a apply missing patch 2022-12-12 23:06:36 +01:00
Michal Hlavinka
7ebc81e5c7 Merge branch 'epel8' into epel9 2022-12-06 23:11:14 +01:00
Michal Hlavinka
3aa7b876a5 fix STATEPATH location and creation (#2024651)
merged C99 related changes to configure from fedora
2022-12-06 22:53:51 +01:00
Michal Hlavinka
833cbe1e9c Merge branch 'epel8' into epel9 2022-11-09 10:12:58 +01:00
Michal Hlavinka
5f339ebaff update to 2.8.0 2022-09-13 20:28:16 +02:00
Orion Poplawski
9d502dbf9e Drop old conditional 2022-01-24 19:06:38 -07:00
Troy Dawson
308ab912ca remove package.cfg per new epel-playground policy 2020-09-24 16:58:08 +00:00
Michal Hlavinka
42618a5303 nut user needs tty group for wall (#1774591) 2020-06-02 20:18:15 +02:00
Michal Hlavinka
ce790c9866 change pid dir from /var/run/nut to /run/nut 2020-02-12 15:32:48 +01:00
Orion Poplawski
a1134bf756 Merge branch 'master' into epel8 2019-10-16 09:40:44 -06:00
Mohan Boddu
ae3b0a6646 Adding package.cfg file
Signed-off-by: Mohan Boddu <mboddu@bhujji.com>
2019-08-01 12:35:00 -04:00
12 changed files with 872 additions and 314 deletions

5
.gitignore vendored
View file

@ -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

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' -e 's/\\//g' clients/Makefile)
VINFO=$(sed -e '/version-info/!d' -e 's/#.*$//' -e 's/^.*-version-info//' -e 's/\\$//' -e 's/[[:space:]]//g' clients/Makefile)
echo "#define LIBUPSCLIENT_PATH \"libupsclient.so.$(( ${VINFO%%:*}-${VINFO##*:} ))\""

12
nut-2.6.5-quickfix.patch Normal file
View file

@ -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)

View file

@ -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.1/clients/upsmon.c.rmpidf nut-2.8.1/clients/upsmon.c
--- nut-2.8.1/clients/upsmon.c.rmpidf 2023-11-01 10:10:03.039782733 +0100
+++ nut-2.8.1/clients/upsmon.c 2023-11-01 10:14:48.824806113 +0100
@@ -3059,6 +3059,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.1/common/common.c.rmpidf nut-2.8.1/common/common.c
--- nut-2.8.1/common/common.c.rmpidf 2023-10-30 00:02:33.000000000 +0100
+++ nut-2.8.1/common/common.c 2023-11-01 10:10:03.040782744 +0100
@@ -519,6 +519,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.1/include/common.h.rmpidf nut-2.8.1/include/common.h
--- nut-2.8.1/include/common.h.rmpidf 2023-10-24 10:45:21.000000000 +0200
+++ nut-2.8.1/include/common.h 2023-11-01 10:10:03.040782744 +0100
@@ -211,6 +211,9 @@ void chroot_start(const char *path);
/* write a pid file - <name> is a full pathname *or* just the program name */
void writepid(const char *name);
@ -46,10 +46,10 @@ 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)
diff -up nut-2.8.1/server/upsd.c.rmpidf nut-2.8.1/server/upsd.c
--- nut-2.8.1/server/upsd.c.rmpidf 2023-11-01 10:10:03.040782744 +0100
+++ nut-2.8.1/server/upsd.c 2023-11-01 10:15:57.176529218 +0100
@@ -2137,5 +2137,6 @@ int main(int argc, char **argv)
upsnotify(NOTIFY_STATE_STOPPING, "Signal %d: exiting", exit_flag);
ssl_cleanup();

View file

@ -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 <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,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

View file

@ -0,0 +1,60 @@
Fix several issues with the AX_C_PRINTF_STRING_NULL check:
Adjust quoting in the AX_C_PRINTF_STRING_NULL definition. Switch to
strstr from strcasestr (a GNU extension, requires -D_GNU_SOURCE)
and include <string.h> instead of <strings.h>. Add missing braces
and parentheses. Use double-quote for string literals.
Submitted upstream: <https://github.com/networkupstools/nut/pull/1720>
diff --git a/m4/ax_c_pragmas.m4 b/m4/ax_c_pragmas.m4
index 53c1aebf8ea35a1e..14ecd596d3b36573 100644
--- a/m4/ax_c_pragmas.m4
+++ b/m4/ax_c_pragmas.m4
@@ -943,32 +943,32 @@ if test -z "${nut_have_ax_c_printf_string_null_seen}"; then
dnl ### To be sure, bolt the language
AC_LANG_PUSH([C])
- AC_CACHE_CHECK([for practical support to pritnf("%s", NULL)],
+ AC_CACHE_CHECK([for practical support to printf("%s", NULL)],
[ax_cv__printf_string_null],
[AX_RUN_OR_LINK_IFELSE(
[AC_LANG_PROGRAM([dnl
#include <stdio.h>
-#include <strings.h>
-], [dnl
+#include <string.h>
+], [[
char buf[128];
char *s = NULL;
int res = snprintf(buf, sizeof(buf), "%s", s);
buf[sizeof(buf)-1] = '\0';
if (res < 0) {
- printf(stderr, "FAILED to snprintf() a NULL string argument");
- exit 1;
+ fprintf(stderr, "FAILED to snprintf() a NULL string argument\n");
+ return 1;
}
-if (buf[0] == '\0')
- printf(stderr, "RETURNED empty string from snprintf() with a NULL string argument");
- exit 0;
+if (buf[0] == '\0') {
+ fprintf(stderr, "RETURNED empty string from snprintf() with a NULL string argument\n");
+ return 0;
}
-if (strcasestr(buf, 'null') == NULL)
- printf(stderr, "RETURNED some string from snprintf() with a NULL string argument: '%s'", buf);
- exit 0;
+if (strstr(buf, "null") == NULL) {
+ fprintf(stderr, "RETURNED some string from snprintf() with a NULL string argument: '%s'\n", buf);
+ return 0;
}
-printf(stderr, "SUCCESS: RETURNED a string that contains something like 'null' from snprintf() with a NULL string argument: '%s'", buf);
-exit 0;
- ])],
+fprintf(stderr, "SUCCESS: RETURNED a string that contains something like 'null' from snprintf() with a NULL string argument: '%s'\n", buf);
+return 0;
+ ]])],
[ax_cv__printf_string_null=yes],
[ax_cv__printf_string_null=no]
)]

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

@ -0,0 +1,17 @@
Call the defined foo function instead of the undeclared func function.
Submitted upstream: <https://github.com/networkupstools/nut/pull/1720>
diff --git a/m4/ax_c___attribute__.m4 b/m4/ax_c___attribute__.m4
index 0e952e7841c35b60..780bc2bb14ac5a78 100644
--- a/m4/ax_c___attribute__.m4
+++ b/m4/ax_c___attribute__.m4
@@ -67,7 +67,7 @@ AC_DEFUN([AX_C___ATTRIBUTE__], [
foo(__attribute__ ((unused)) int i) {
return;
}
- ]], [func(1);])],
+ ]], [foo(1);])],
[ax_cv___attribute__unused_arg=yes],
[ax_cv___attribute__unused_arg=no]
)

836
nut.spec

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
SHA512 (nut-2.8.4.tar.gz) = 0d87c0006608f92ae54f8a500f93d9a81eac1d9abf57f32e7718dd72f265b8293a0b6cdba04c802b81eaf8907b52669c36b47b6875a4377f9752845ac6c5e8fa
SHA512 (nut-2.8.2.tar.gz) = b6f8f22318e4a4fcb8073a63132b1cb083952c665191b82a7d6765a61b859575a4b0c2ba84ed17cfb8c88d34179876d64520dd2f75f02fe8707b406da2c0821c

147
ups.init Normal file
View file

@ -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

8
ups.sysconfig Normal file
View file

@ -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]