Sync from SUSE:SLFO:Main nut revision 71ffbff551d77025179c6fa023991893

This commit is contained in:
Adrian Schröter 2024-11-15 13:59:27 +01:00
commit 50ba8b2405
14 changed files with 2374 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

161
README.SUSE Normal file
View File

@ -0,0 +1,161 @@
COnfiguration and use of NUT in SuSE
NUT in openSUSE comes in several packages:
- nut - The core package. It features UPS monitoring and network UPS
management.
and two additional packages:
- nut-drivers-net - two additional drivers for network communication of
UPS daemons. You will need for advanced configuration (e. g. if you
want to manage shutdown of more computers sharing the same UPS).
- nut-cgi provides support for monitoring UPS web pages using apache web
browser. Predefined address is http://localhost/nut/index.html
nut Configuration
NUT is pre-configured to use a local or remote UPS as far as possible.
But it still requires a minimal manual configuration before the first
use.
This document contains:
- How to configure local or remote UPS (mandatory reading).
- How to configure to suspend to disk (optional reading).
- What to do in environment with possible service timeouts (optional
reading).
The default setup uses one local UPS. You have to define UPS type in
file /etc/ups/ups.conf.
It requires only few adoptions before you can start the service:
* Configuration of a locally connected UPS:
In /etc/ups/ups.conf:
- Go to the [myups] section at the end of the file.
- Set driver key to the driver name supporting your UPS.
(see /usr/lib/ups/driver/ for possible drivers. Each driver
has a man page. Many USB UPSes are usbhid-ups.)
- Set port key to the device your UPS is connected to,
e.g. /dev/ttyS0 for first serial port (COM1) or
/dev/usb/hiddev0
for USB HID UPS.
- Adjust desc key as you want.
Start the service:
- "/etc/init.d/upsd start"
* Configuration of a UPS connected to a remote machine:
In /etc/ups/ups.conf:
- Comment out or remove the [myups] section at the end of the
file.
In /etc/ups/upsmon.conf:
- Find the uncommented MONITOR line followed by
"myups@localhost" and change it to:
MONITOR myups@remote_machine 1 upsslave remote_password slave
Where:
remote_machine is a hostname of the remote machine.
remote_password is the password used for upsslave on the
remote machine (you can find it in the remote file
/etc/ups/upsd.users).
In /etc/ups/hosts.conf:
- Find the uncommented MONITOR line followed by
"myups@localhost".
- Change the hostname from "localhost" to the hostname of
the remote machine.
- Change the description as you want.
In the remote /etc/ups/upsd.conf:
- Add a rule for the remote clients relevant to your network or
your needs. Standard local networks are:
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16
ACL my_network 192.168.0.0/16
ACCEPT my_network
In the remote /etc/ups/upsd.users:
- Find the line allowfrom for upsslave user.
- Add your local machine name to the allowfrom list.
In the remote SuSE firewall:
- Enable nut (Network UPS Tools) service (port 3493), e. g. by
"YaST2 firewall".
Start the service:
- "/etc/init.d/upsd start" on both local and remote machines.
- If you have edited configuration of a running server, run
"/etc/init.d/upsd reload"
* Test the configuration using upsc or upslog:
- "upsc myups@localhost"
Should display information about the UPS status.
- "upslog -s myups@localhost -l -"
Should display UPS status log every 30 seconds.
(Press Ctrl-C keys to stop upslog).
Notes:
- Predefined user upsmaster
There are two predefined users - upsmaster and upsslave. The passwords
for them are generated during the installation (see the "password"
lines in /etc/ups/upsd.users).
User upsmaster has privileges to shut down master machine (default for
local UPS), upsslave has privileges to shut down slave machines.
If you change it, or add another user, don't forget to adopt the
MONITOR lines in upsmon.conf on all machines using this user and
password combination to connect to the upsd.
Suspend to disk
If you want to configure nut to do suspend to disk instead of shutdown
you should:
- Verify, that suspend to disk works correctly with your desktop:
sudo systemctl hibernate
(You can lose your unsaved data, if your computer does not support
suspend.)
- Change SHUTDOWNCMD in /etc/ups/upsmon.conf to:
SHUTDOWNCMD "/usr/bin/systemctl hibernate"
- Verify, that your UPS provides reasonable grace period to complete
suspend in all situations.
Environment with possible service timeouts
In some environments, there is no guarantee, that the machine will
correctly shut down, either because other machines providing critical
services are already down or because some services (e. g. squid) are
stopping too long and battery power is not sufficient. In this case,
you can prefer incorrect but fast shutdown.
To fix this problem, you need to do:
- Copy upsd-early-powerdown script to your /etc/init.d/ directory.
- Edit following lines:
Replace "FIXME scripts which should not stop before powerdown" by an
appropriate init script list.
Replace "FIXME scripts which should stop before powerdown" by an
appropriate init script list.
- Start YaST Runlevel Editor and enable this meta-service in
runlevels, where you want to apply early shutdown.

View File

@ -0,0 +1,21 @@
diff -purN a/scripts/systemd/nut-driver@.service.in b/scripts/systemd/nut-driver@.service.in
--- a/scripts/systemd/nut-driver@.service.in 2023-10-07 16:06:44.000000000 +0200
+++ b/scripts/systemd/nut-driver@.service.in 2023-11-03 19:46:30.856267504 +0100
@@ -46,6 +46,17 @@ PartOf=nut-driver.target
# Finally note that "nut-driver-enumerator.service" should take care of this.
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
Environment=NUT_IGNORE_NOWAIT=true
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N

View File

@ -0,0 +1,21 @@
diff -purN a/scripts/systemd/nut-monitor.service.in b/scripts/systemd/nut-monitor.service.in
--- a/scripts/systemd/nut-monitor.service.in 2023-10-07 16:06:44.000000000 +0200
+++ b/scripts/systemd/nut-monitor.service.in 2023-11-03 19:48:16.280004811 +0100
@@ -25,6 +25,17 @@ Wants=nut-server.service
PartOf=nut.target
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N
ExecStartPre=-@SYSTEMD_TMPFILES_PROGRAM@ --create @systemdtmpfilesdir@/nut-common-tmpfiles.conf

View File

@ -0,0 +1,21 @@
diff -purN a/scripts/systemd/nut-server.service.in b/scripts/systemd/nut-server.service.in
--- a/scripts/systemd/nut-server.service.in 2023-10-07 16:06:44.000000000 +0200
+++ b/scripts/systemd/nut-server.service.in 2023-11-03 19:49:51.496940092 +0100
@@ -26,6 +26,17 @@ Before=nut-monitor.service
PartOf=nut.target
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
# A busy server can be monitoring a lot of devices as well as replying
# to many clients. The "infinity" definition is actually capped by OS
# settings and hardcoded defaults; typically can be 65535+ nowadays.

BIN
nut-2.8.2-repack.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

28
nut-doc-fixed-date.patch Normal file
View File

@ -0,0 +1,28 @@
diff -purN a/docs/Makefile.am b/docs/Makefile.am
--- a/docs/Makefile.am 2023-10-16 10:06:18.000000000 +0200
+++ b/docs/Makefile.am 2023-11-03 19:40:55.360576893 +0100
@@ -248,8 +248,8 @@ solaris-usb.html solaris-usb.chunked sol
A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) \
--attribute=icons \
--xsltproc-opts="--nonet" \
- --xsltproc-opts="--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d`\"" \
- --xsltproc-opts="--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S`\"" \
+ --xsltproc-opts "--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d -r $(top_srcdir)/ChangeLog`\"" \
+ --xsltproc-opts "--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S -r $(top_srcdir)/ChangeLog`\"" \
--xsltproc-opts="--stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \
--attribute=docinfodir="$(builddir)" \
--attribute=iconsdir="$(srcdir)/images" \
diff -purN a/docs/man/Makefile.am b/docs/man/Makefile.am
--- a/docs/man/Makefile.am 2023-10-24 10:45:21.000000000 +0200
+++ b/docs/man/Makefile.am 2023-11-03 19:41:55.114481978 +0100
@@ -999,8 +999,8 @@ DOCBUILD_END = { \
echo " DOC-MAN-HTML Generating $@"; \
$(DOCBUILD_BEGIN) ; RES=0; \
$(ASCIIDOC) --backend=xhtml11 $${A2X_VERBOSE} \
- --attribute localdate="`TZ=UTC date +%Y-%m-%d`" \
- --attribute localtime="`TZ=UTC date +%H:%M:%S`" \
+ --attribute localdate=`TZ=UTC date +%Y-%m-%d -r $(top_srcdir)/ChangeLog` \
+ --attribute localtime=`TZ=UTC date +%H:%M:%S -r $(top_srcdir)/ChangeLog` \
--attribute nutversion="@PACKAGE_VERSION@" \
--attribute srcdir="$(abs_srcdir)/" \
--attribute builddir="$(abs_builddir)/" \

19
nut-notifyflag.patch Normal file
View File

@ -0,0 +1,19 @@
diff -purN a/conf/upsmon.conf.sample.in b/conf/upsmon.conf.sample.in
--- a/conf/upsmon.conf.sample.in 2023-10-28 23:36:02.000000000 +0200
+++ b/conf/upsmon.conf.sample.in 2023-11-03 19:38:24.015393331 +0100
@@ -364,6 +364,15 @@ POWERDOWNFLAG "@POWERDOWNFLAG@"
#
# If you use IGNORE, don't use any other flags on the same line.
+NOTIFYFLAG ONLINE SYSLOG
+NOTIFYFLAG COMMOK SYSLOG
+NOTIFYFLAG SHUTDOWN SYSLOG
+NOTIFYFLAG ONBATT SYSLOG+WALL
+NOTIFYFLAG LOWBATT SYSLOG+WALL
+NOTIFYFLAG FSD SYSLOG+WALL
+NOTIFYFLAG NOCOMM SYSLOG+WALL
+NOTIFYFLAG COMMBAD SYSLOG+WALL
+
# --------------------------------------------------------------------------
# OFFDURATION - put "OFF" state into effect if it persists for this many seconds
#

48
nut-preconfig.patch Normal file
View File

@ -0,0 +1,48 @@
diff -purN a/conf/hosts.conf.sample b/conf/hosts.conf.sample
--- a/conf/hosts.conf.sample 2023-02-28 13:49:32.000000000 +0100
+++ b/conf/hosts.conf.sample 2023-11-03 19:28:46.048488997 +0100
@@ -27,3 +27,5 @@
# MONITOR myups@localhost "Local UPS"
# MONITOR su2200@10.64.1.1 "Finance department"
# MONITOR matrix@shs-server.example.edu "Sierra High School data room #1"
+
+MONITOR myups@localhost "Local UPS"
diff -purN a/conf/ups.conf.sample b/conf/ups.conf.sample
--- a/conf/ups.conf.sample 2023-10-28 23:02:42.000000000 +0200
+++ b/conf/ups.conf.sample 2023-11-03 19:29:35.641548694 +0100
@@ -214,3 +214,8 @@ maxretry = 3
#
# To find out if your driver supports any extra settings, start it with
# the -h option and/or read the driver's documentation.
+
+[myups]
+ driver = undefined
+ port = /dev/undefined
+ desc = "Local UPS"
diff -purN a/conf/upsd.conf.sample b/conf/upsd.conf.sample
--- a/conf/upsd.conf.sample 2023-09-17 16:34:05.000000000 +0200
+++ b/conf/upsd.conf.sample 2023-11-03 19:30:18.374644467 +0100
@@ -183,3 +183,11 @@
# or CLI options, regardless of older logging level being higher or lower
# than the newly found number; a missing (or commented away) value however
# does not change the previously active logging verbosity.
+
+[upsmaster]
+ password = @UPSD_INITIAL_MASTER_PASSWORD@
+ upsmon master
+
+[upsslave]
+ password = @UPSD_INITIAL_SLAVE_PASSWORD@
+ upsmon slave
diff -purN a/conf/upsmon.conf.sample.in b/conf/upsmon.conf.sample.in
--- a/conf/upsmon.conf.sample.in 2023-10-28 23:36:02.000000000 +0200
+++ b/conf/upsmon.conf.sample.in 2023-11-03 19:25:57.482732658 +0100
@@ -117,6 +117,8 @@
# MONITOR su700@server.example.com 1 monuser secretpass secondary
# MONITOR myups@localhost 1 monuser pass primary # (or secondary)
+MONITOR myups@localhost 1 upsmaster @UPSD_INITIAL_MASTER_PASSWORD@ master
+
# --------------------------------------------------------------------------
# MINSUPPLIES <num>
#

1286
nut.changes Normal file

File diff suppressed because it is too large Load Diff

167
nut.keyring Normal file
View File

@ -0,0 +1,167 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: B834 59F7 76B9 0224 988F 36C0 DE01 84DA 7043 DCF7
Comment: Jim Klimov (Doing FOSS since last millennium) <jimklimo
xsFNBGR3M1EBEACkBuMkPcSzZo5cNPEbr5xwJNQxsiLkujNhAr6qyhqMi6BShLEV
1O2dKGe0XQy1antZWl/YLuB4LVg09zg95UCMuf392JOqJ/9nHjMRX101xX/AlhfA
M/3SysGADAomS4dOTt06R1RzSkU0G579FVRa1ZjnOvVKjJBw+3DQ8dWgDJC2hdhC
UUYHWLvetq+n+WtDUeFgI8BqqW1YCOJgi/clUVuy85bP+BWjYIRnOpiRjIDWuk1d
KujIIwFR9e8lJB8rN68zl1GcqQL4NhFfdSVTByddala55poYC3iUA33n5276KKvD
dlStN9lqgDpKlR2NJnYrnPJIyJEmUdjLImQaxAiQvhk+H21XBz6a/IWiOakXJ+j2
M1zkTmFjd1UOUoRHdwuB8ajFrw3T8Mz/4FygYTRyufaTv3wRqpd51jHUcjoZ8zwR
rS/UPvhiZU0YtKX3NtoyKlMeKGCG/s4eep/jP3mpgU/+uOJzF3SLBGA+L2+A8nwf
Xq6yYucTnx0INqvb6K5EWQH+qfvxHg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KKTaMOZIqtsGITZjWt9n9nO+qtRhQr3953okaqZpMuAH+zJjZ5rl81kh0ow
3cK7qChiYGdjUs4fkPKgbCEvevjKrDNpw+Mgdm1ZhR6fiJ6Eto2tKlLU06EXz+Ti
ob4mwz+hktnl6vaBTcFt8Xh20RqSXruYYaYKPDff8+l2+vi1Ly6d3I//noogKiiY
robYJcFvq9Nqudw=
=GbxM
-----END PGP PUBLIC KEY BLOCK-----

6
nut.rpmlintrc Normal file
View File

@ -0,0 +1,6 @@
addFilter("binary-or-shlib-calls-gethostbyname /usr/libexec/ups/driver/apcupsd-ups")
addFilter("logrotate-log-dir-not-packaged /var/log$")
addFilter("obsolete-not-provided nut-devel-doc-pdf")
addFilter("obsolete-not-provided nut-doc-pdf")
addFilter("obsolete-not-provided nut-hal")
addFilter("potential-bashisms /usr/libexec/nut-driver-enumerator.sh")

553
nut.spec Normal file
View File

@ -0,0 +1,553 @@
#
# spec file for package nut
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define CGIPATH %{apache_serverroot}/cgi-bin/%{name}
%define HTMLPATH %{apache_serverroot}/htdocs/%{name}
%define MODELPATH %{_libexecdir}/ups/driver
%define STATEPATH %{_localstatedir}/lib/ups
%define CONFPATH %{_sysconfdir}/ups
%define PIDPATH %{_rundir}
%define NUT_USER upsd
%define NUT_GROUP daemon
%define LBRACE (
%define RBRACE )
%define QUOTE "
%define BACKSLASH \\
# Collect all devices listed in ups-nut-device.fdi:
%define USBHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | grep -a -A1 USBHID-UPS | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ')
%define USBNONHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | grep -a -A1 _USB | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ')
%define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd)
%define bashcompletionsdir %(pkg-config bash-completion --variable=completionsdir)
%bcond_with texdoc
%if 0%{?suse_version} >= 1500
%bcond_without libi2c
%else
%bcond_with libi2c
%endif
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150400
%bcond_without libmodbus
%else
%bcond_with libmodbus
%endif
%if 0%{?suse_version} == 1500
%bcond_without libnsl
%else
%bcond_with libnsl
%endif
%ifarch %{ix86} x86_64 ia64
%bcond_without libfreeipmi
%else
%bcond_with libfreeipmi
%endif
Name: nut
Version: 2.8.2
Release: 0
Summary: Network UPS Tools Core (Uninterruptible Power Supply Monitoring)
License: GPL-2.0-or-later
Group: Hardware/UPS
URL: https://www.networkupstools.org/
# Repack with upstream PR #2623 patched in due to files with proprietary license
Source0: %{name}-%{version}-repack.tar.gz
Source2: README.SUSE
Source3: nut.rpmlintrc
Source4: nut.keyring
Source6: nut.system-sleep
Patch0: nut-preconfig.patch
Patch1: nut-notifyflag.patch
# PATCH-FEATURE-OPENSUSE nut-doc-fixed-date.patch sbrabec@suse.cz -- Make doc builds reproducible.
Patch2: nut-doc-fixed-date.patch
Patch3: harden_nut-driver.service.patch
Patch4: harden_nut-monitor.service.patch
Patch5: harden_nut-server.service.patch
BuildRequires: apache-rpm-macros
BuildRequires: asciidoc
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libcppunit-devel
BuildRequires: libtool
BuildRequires: libxml2-tools
BuildRequires: libxslt-tools
BuildRequires: net-snmp-devel
BuildRequires: pkgconfig
BuildRequires: tcpd-devel
BuildRequires: pkgconfig(avahi-client)
BuildRequires: pkgconfig(avahi-core)
BuildRequires: pkgconfig(bash-completion)
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(gdlib)
BuildRequires: pkgconfig(libgpiod) >= 1.0.0
BuildRequires: pkgconfig(libpowerman)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libusb-1.0)
BuildRequires: pkgconfig(neon)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(udev)
Requires: logrotate
Requires: usbutils
Requires(post): udev
# Package provides driver for USB HID UPSes, but people can live with hal addon:
Enhances: %{USBHIDDRIVERS}
# Package provides the only avalailable driver for other USB UPSes:
Supplements: %{USBNONHIDDRIVERS}
# for update from openSUSE <= 11.3, SLE <= 11
Provides: nut-classic = %{version}
Obsoletes: nut-classic < %{version}
Obsoletes: nut-hal < %{version}
%{?systemd_requires}
%if %{with libfreeipmi}
BuildRequires: pkgconfig(libfreeipmi)
%endif
%if %{with libi2c}
BuildRequires: libi2c0-devel
%endif
%if %{with libmodbus}
BuildRequires: pkgconfig(libmodbus)
%endif
%if %{with libnsl}
BuildRequires: pkgconfig(libnsl)
%endif
%if %{with texdoc}
BuildRequires: asciidoc-latex-backend
%else
# Obsolete all the docu stuff with disabled tex dependencies
Obsoletes: %{name}-devel-doc-pdf <= %{version}
Obsoletes: %{name}-doc-pdf <= %{version}
%endif
%if 0%{?suse_version} >= 1500
BuildRequires: source-highlight
Requires(pre): user(upsd)
%endif
%description
Core package of Network UPS Tools.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package drivers-net
Summary: Network UPS Tools - Extra Networking Drivers (for Network Monitoring)
Group: Hardware/UPS
Requires: %{name} = %{version}
Enhances: %{name}
%description drivers-net
Networking drivers for the Network UPS Tools. You will need them
together with nut to provide UPS networking support.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package -n libnutclient2
Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring)
Group: System/Libraries
Conflicts: libupsclient1
%description -n libnutclient2
Shared library for the Network UPS Tools.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package -n libnutscan2
Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring)
Group: System/Libraries
Conflicts: libupsclient1
%description -n libnutscan2
Shared library for the Network UPS Tools.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package -n libupsclient6
Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring)
Group: System/Libraries
Conflicts: libupsclient1
%description -n libupsclient6
Shared library for the Network UPS Tools.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package -n libnutclientstub1
Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring)
Group: System/Libraries
Conflicts: libupsclient1
%description -n libnutclientstub1
Shared library for the Network UPS Tools.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package cgi
Summary: Network UPS Tools Web Server Support (UPS Status Pages)
Group: Hardware/UPS
Requires: %{name} = %{version}
Enhances: %{name}
Supplements: (%{name} and apache2)
%description cgi
Web server support package for the Network UPS Tools.
Predefined URL is http://localhost/nut/index.html
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package devel
Summary: Network UPS Tools (Uninterruptible Power Supply Monitoring)
Group: Development/Libraries/C and C++
Requires: libnutclient2 = %{version}-%{release}
Requires: libnutclientstub1 = %{version}-%{release}
Requires: libnutscan2 = %{version}-%{release}
Requires: libupsclient6 = %{version}-%{release}
Requires: pkgconfig(openssl)
%description devel
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package doc-asciidoc
Summary: Network UPS Tools - Documentation in AsciiDoc Format
Group: Documentation/Other
Requires: %{name}-doc-images = %{version}
Recommends: %{name} = %{version}
Enhances: %{name}
BuildArch: noarch
%description doc-asciidoc
NUT manuals in AsciiDoc format (human readable source).
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package devel-doc-html
Summary: Network UPS Tools - Documentation in HTML
# For CSS files:
Group: Documentation/HTML
Requires: %{name}-doc-html = %{version}
Requires: %{name}-doc-images = %{version}
Recommends: %{name} = %{version}
Enhances: %{name}
BuildArch: noarch
%description devel-doc-html
Developer manual in HTML format.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package doc-html
Summary: Network UPS Tools - Documentation in HTML
Group: Documentation/HTML
Requires: %{name}-doc-images = %{version}
Recommends: %{name} = %{version}
Enhances: %{name}
BuildArch: noarch
%description doc-html
User manual in HTML format.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package doc-images
Summary: Network UPS Tools - Images for Documentation
Group: Documentation/Other
Requires: %{name}-doc-images = %{version}
Recommends: %{name} = %{version}
Enhances: %{name}
BuildArch: noarch
%description doc-images
Images for the documentation. It is a supplementary package for some NUT
documentation packages.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%if %{with texdoc}
%package doc-pdf
Summary: Network UPS Tools - Documentation in PDF
Group: Documentation/Other
Recommends: %{name} = %{version}
Enhances: %{name}
BuildArch: noarch
%description doc-pdf
User manual in PDF format.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%package devel-doc-pdf
Summary: Network UPS Tools - Documentation in PDF
Group: Documentation/Other
Recommends: %{name} = %{version}
Enhances: %{name}
BuildArch: noarch
%description devel-doc-pdf
Developer manual in PDF format.
Network UPS Tools is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
%endif
%prep
%autosetup -p1
cp -a %{SOURCE2} .
sed -i s/@now@/`date -r ChangeLog +%%Y-%%m-%%d`/g docs/docinfo.xml.in
%build
autoreconf -fvi
%configure \
--disable-static \
--sysconfdir=%{CONFPATH} \
--datadir=%{_datadir}/%{name} \
--with-all \
%if %{with texdoc}
--with-doc="man html-single html-chunked pdf" \
%else
--with-doc="man html-single html-chunked" \
%endif
--with-ssl \
--with-openssl \
--without-nss \
%if %{without libmodbus}
--without-modbus \
%endif
%if %{with libnsl}
--with-wrap \
%endif
%if %{without libfreeipmi}
--without-ipmi \
%endif
%if %{without libi2c}
--without-i2c
%endif
--with-htmlpath=%{HTMLPATH} \
--with-cgipath=%{CGIPATH} \
--with-statepath=%{STATEPATH} \
--with-drvpath=%{MODELPATH} \
--with-pidpath=%{PIDPATH} \
--with-user=%{NUT_USER} \
--with-group=%{NUT_GROUP} \
--with-udev-dir=%{_udevrulesdir}/.. \
--enable-option-checking=fatal
# does not create reproducible output with parallelism
%make_build -j1
%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print
mkdir -p %{buildroot}%{STATEPATH}
mkdir -p %{buildroot}%{_docdir}/%{name}
mkdir -p %{buildroot}%{_sbindir}
# initscript
ln -s service %{buildroot}%{_sbindir}/rcnut-driver
ln -s service %{buildroot}%{_sbindir}/rcnut-server
ln -s service %{buildroot}%{_sbindir}/rcnut-monitor
rename .sample "" %{buildroot}%{_sysconfdir}/ups/*.sample
install -D -m 750 %{SOURCE6} %{buildroot}%{systemdsystemdutildir}/system-sleep/%{name}.sh
install -D -m 644 scripts/logrotate/nutlogd %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -D -m 644 scripts/misc/nut.bash_completion %{buildroot}%{bashcompletionsdir}/%{name}
# Documentation
cp -a docs/*.txt docs/cables docs/images %{buildroot}%{_docdir}/%{name}/
cp -a docs/*.css docs/*.html %{buildroot}%{_docdir}/%{name}/
%if %{with texdoc}
cp -a docs/*.pdf %{buildroot}%{_docdir}/%{name}/
%endif
# Not needed for packaged contents:
rm -f %{buildroot}%{_docdir}/%{name}/packager-guide.*
rm -f %{buildroot}%{_docdir}/%{name}/cables/Makefile*
rm -f %{buildroot}%{_docdir}/%{name}/cables/*.txt-prepped
# Create symlinks for man pages
%fdupes -s %{buildroot}%{_mandir}
%pre
%if 0%{?suse_version} < 1330
getent passwd %{NUT_USER} >/dev/null || useradd -r -g %{NUT_GROUP} -s /bin/false -c "UPS daemon" -d /sbin %{NUT_USER} 2>/dev/null
%endif
%service_add_pre nut-server.service nut-monitor.service nut-driver-enumerator.path nut-driver-enumerator.service nut-driver.target nut.target nut-driver-enumerator-daemon-activator.path nut-driver-enumerator-daemon-activator.service nut-driver-enumerator-daemon.service
%post
# Generate initial passwords.
if grep -q "password = @UPSD_INITIAL_MASTER_PASSWORD@" %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users; then
UPSD_INITIAL_MASTER_PASSWORD=$(head -c 20 /dev/urandom | md5sum | head -c 10)
sed -i s/@UPSD_INITIAL_MASTER_PASSWORD@/$UPSD_INITIAL_MASTER_PASSWORD/ %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
fi
if grep -q "password = @UPSD_INITIAL_SLAVE_PASSWORD@" %{CONFPATH}/upsd.users ; then
UPSD_INITIAL_SLAVE_PASSWORD=$(head -c 20 /dev/urandom | md5sum | head -c 10)
sed -i s/@UPSD_INITIAL_SLAVE_PASSWORD@/$UPSD_INITIAL_SLAVE_PASSWORD/ %{CONFPATH}/upsd.users
fi
# Migrate Suspend to Disc to the new convention (bnc#449861 and later bnc#871406):
# It was never on by default, but documentation up to 11.0 recommends
# "shutdown -z +0" for suspend to disc. It was discontinued before 11.0.
# Documentation since 11.0 up to 13.1 recommends /powersave -U.
# pm-utils (and powersave) were obsoleted after 13.1 in favor of systemd.
if grep "shutdown -z +0" %{_sysconfdir}/ups/upsmon.conf ; then
sed -i 's:/sbin/shutdown -z +0:%{_bindir}/systemctl hibernate:;s:shutdown -z +0:%{_bindir}/systemctl hibernate:' %{_sysconfdir}/ups/upsmon.conf
fi
if grep "powersave -U" %{_sysconfdir}/ups/upsmon.conf ; then
sed -i 's:%{_bindir}/powersave -U:%{_bindir}/systemctl hibernate:;s:powersave -U:%{_bindir}/systemctl hibernate:' %{_sysconfdir}/ups/upsmon.conf
fi
# And finally trigger udev to set permissions according to newly installed rules files.
udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device
%service_add_post nut-server.service nut-monitor.service nut-driver-enumerator.path nut-driver-enumerator.service nut-driver.target nut.target nut-driver-enumerator-daemon-activator.path nut-driver-enumerator-daemon-activator.service nut-driver-enumerator-daemon.service
%tmpfiles_create %{_tmpfilesdir}/%{name}-common-tmpfiles.conf
%preun
%service_del_preun nut-server.service nut-monitor.service nut-driver-enumerator.path nut-driver-enumerator.service nut-driver.target nut.target nut-driver-enumerator-daemon-activator.path nut-driver-enumerator-daemon-activator.service nut-driver-enumerator-daemon.service
%postun
%service_del_postun nut-server.service nut-monitor.service nut-driver-enumerator.path nut-driver-enumerator.service nut-driver.target nut.target nut-driver-enumerator-daemon-activator.path nut-driver-enumerator-daemon-activator.service nut-driver-enumerator-daemon.service
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150400
%ldconfig_scriptlets -n libnutclient2
%ldconfig_scriptlets -n libnutclientstub1
%ldconfig_scriptlets -n libnutscan2
%ldconfig_scriptlets -n libupsclient6
%else
%post -n libnutclient2 -p /sbin/ldconfig
%postun -n libnutclient2 -p /sbin/ldconfig
%post -n libnutclientstub1 -p /sbin/ldconfig
%postun -n libnutclientstub1 -p /sbin/ldconfig
%post -n libnutscan2 -p /sbin/ldconfig
%postun -n libnutscan2 -p /sbin/ldconfig
%post -n libupsclient6 -p /sbin/ldconfig
%postun -n libupsclient6 -p /sbin/ldconfig
%endif
%files
%doc AUTHORS ChangeLog MAINTAINERS NEWS.adoc README.adoc README.SUSE UPGRADING.adoc
%license COPYING
%config %{_sysconfdir}/logrotate.d/*
%{_bindir}/*
%{_datadir}/%{name}
%{_mandir}/man5/*%{ext_man}
%{_mandir}/man8/*%{ext_man}
%exclude %{_mandir}/man8/netxml-ups*.*
%exclude %{_mandir}/man8/snmp-ups*.*
%dir %{_libexecdir}/ups
%{_libexecdir}/nut-driver-enumerator.sh
%python_sitearch/PyNUT.py
%{_sbindir}/*
%{_udevrulesdir}/*.rules
%config(noreplace) %{CONFPATH}/hosts.conf
%config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.conf
%config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.users
%config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsmon.conf
%dir %{CONFPATH}
%config(noreplace) %{CONFPATH}/nut.conf
%config(noreplace) %{CONFPATH}/ups.conf
%config(noreplace) %{CONFPATH}/upsset.conf
%config(noreplace) %{CONFPATH}/upssched.conf
%dir %{MODELPATH}
%{MODELPATH}/*
%exclude %{MODELPATH}/snmp-ups
%exclude %{MODELPATH}/netxml-ups
%dir %attr(700,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH}
%{_unitdir}/*.path
%{_unitdir}/*.target
%{_unitdir}/*.service
%{systemdsystemdutildir}/system-shutdown/*
%{systemdsystemdutildir}/system-sleep/%{name}.sh
%{bashcompletionsdir}/*
%{_tmpfilesdir}/%{name}-common-tmpfiles.conf
%ghost %{_rundir}/%{name}
%ghost %attr(700,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH}/upssched
%files drivers-net
%{MODELPATH}/snmp-ups
%{MODELPATH}/netxml-ups
%{_mandir}/man8/netxml-ups*%{ext_man}
%{_mandir}/man8/snmp-ups*%{ext_man}
%files -n libnutclient2
%{_libdir}/libnutclient.so.*
%files -n libnutclientstub1
%{_libdir}/libnutclientstub.so.*
%files -n libnutscan2
%{_libdir}/libnutscan.so.*
%files -n libupsclient6
%{_libdir}/libupsclient.so.*
%files cgi
%dir %{apache_serverroot}
%dir %{apache_serverroot}/cgi-bin
%dir %{apache_serverroot}/htdocs
%{CGIPATH}
%{HTMLPATH}
%config(noreplace) %{CONFPATH}/upsstats-single.html
%config(noreplace) %{CONFPATH}/upsstats.html
%files devel
%{_includedir}/*.h
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_libexecdir}/sockdebug
%{_mandir}/man3/*%{ext_man}
%python_sitearch/test_nutclient.py
%files doc-asciidoc
%doc %dir %{_docdir}/%{name}{,/cables}
%{_docdir}/%{name}/*.txt
%{_docdir}/%{name}/cables/*.txt
%files devel-doc-html
%{_docdir}/%{name}/developer-guide.html
%files doc-html
%{_docdir}/%{name}/ChangeLog.html
%{_docdir}/%{name}/FAQ.html
%{_docdir}/%{name}/cables.html
%{_docdir}/%{name}/release-notes.html
%{_docdir}/%{name}/solaris-usb.html
%{_docdir}/%{name}/user-manual.html
%{_docdir}/%{name}/*.css
%files doc-images
%doc %dir %{_docdir}/%{name}
%{_docdir}/%{name}/images
%if %{with texdoc}
%files doc-pdf
%doc %dir %{_docdir}/%{name}
%{_docdir}/%{name}/FAQ.pdf
%{_docdir}/%{name}/cables.pdf
%{_docdir}/%{name}/solaris-usb.pdf
%{_docdir}/%{name}/user-manual.pdf
%files devel-doc-pdf
%doc %dir %{_docdir}/%{name}
%{_docdir}/%{name}/developer-guide.pdf
%endif
%changelog

17
nut.system-sleep Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# Always stop nut before sleep, but do not initiate powerdown for hybrid-sleep.
if [ "$1" = pre ] && ( [ "$2" = hibernate ] || [ "$2" = hybrid-sleep ] ) ; then
/usr/bin/systemctl stop nut-server.service
fi
if [ "$1" = pre ] && [ "$2" = hibernate ] ; then
# FIXME: All hibernate quirks are called in parallel. To be on a safest side, we should initiate powerdown grace period when they terminate.
sleep 5
if test -n "$POWERDOWNFLAG" -a -f "$POWERDOWNFLAG" ; then
export UPSD_POWERDOWN_CONDITION=1
/usr/sbin/upsdrvctl shutdown
fi
fi
if [ "$1" = post ] && ( [ "$2" = hibernate ] || [ "$2" = hybrid-sleep ] ) ; then
/usr/bin/systemctl start nut-server.service
fi