diff --git a/apcupsd-3.14.4-shutdown.patch b/apcupsd-3.14.4-shutdown.patch deleted file mode 100644 index 00651b5..0000000 --- a/apcupsd-3.14.4-shutdown.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up apcupsd-3.14.4/platforms/apccontrol.in.shutdown apcupsd-3.14.4/platforms/apccontrol.in ---- apcupsd-3.14.4/platforms/apccontrol.in.shutdown 2008-05-28 09:15:47.000000000 +0200 -+++ apcupsd-3.14.4/platforms/apccontrol.in 2008-05-28 09:16:04.000000000 +0200 -@@ -104,7 +104,7 @@ case "$1" in - ;; - doshutdown) - echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} -- ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" -+ ${SHUTDOWN} -h -H now "apcupsd UPS ${2} initiated shutdown" - ;; - annoyme) - echo "Power problems with UPS ${2}. Please logoff." | ${WALL} diff --git a/apcupsd-3.14.8-systemd.patch b/apcupsd-3.14.8-systemd.patch deleted file mode 100644 index b0a24cb..0000000 --- a/apcupsd-3.14.8-systemd.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -up apcupsd-3.14.8/apcupsd.service.systemd apcupsd-3.14.8/apcupsd.service ---- apcupsd-3.14.8/apcupsd.service.systemd 2011-06-16 10:33:02.335889489 +0200 -+++ apcupsd-3.14.8/apcupsd.service 2011-06-16 09:59:02.616138047 +0200 -@@ -0,0 +1,11 @@ -+[Unit] -+Description=APC UPS Power Control Daemon for Linux -+After=syslog.target -+After=network.target -+ -+[Service] -+ExecStartPre=-/bin/rm -f /etc/apcupsd/powerfail -+ExecStart=/sbin/apcupsd -b -f /etc/apcupsd/apcupsd.conf -+ -+[Install] -+WantedBy=multi-user.target -diff -up apcupsd-3.14.8/apcupsd_shutdown.systemd apcupsd-3.14.8/apcupsd_shutdown ---- apcupsd-3.14.8/apcupsd_shutdown.systemd 2011-06-16 10:33:08.831934420 +0200 -+++ apcupsd-3.14.8/apcupsd_shutdown 2011-06-16 10:10:20.948796784 +0200 -@@ -0,0 +1,9 @@ -+#!/bin/sh -+ -+# See if this is a powerfail situation. -+if [ -f /etc/apcupsd/powerfail ]; then -+ echo -+ echo "APCUPSD will now power off the UPS" -+ echo -+ /etc/apcupsd/apccontrol killpower -+fi diff --git a/apcupsd.service b/apcupsd.service new file mode 100644 index 0000000..fb50d9d --- /dev/null +++ b/apcupsd.service @@ -0,0 +1,11 @@ +[Unit] +Description=APC UPS Power Control Daemon for Linux +After=syslog.target +After=network-online.target + +[Service] +ExecStartPre=-/bin/rm -f /etc/apcupsd/powerfail +ExecStart=/sbin/apcupsd -b -f /etc/apcupsd/apcupsd.conf + +[Install] +WantedBy=multi-user.target diff --git a/apcupsd.spec b/apcupsd.spec index 145249d..91cb152 100644 --- a/apcupsd.spec +++ b/apcupsd.spec @@ -1,22 +1,19 @@ -Name: apcupsd -Version: 3.14.14 -Release: 2%{?dist} -Summary: APC UPS Power Control Daemon - -License: GPLv2 -URL: http://www.apcupsd.com -Source0: https://downloads.sourceforge.net/apcupsd/apcupsd-%version.tar.gz -Source1: apcupsd.logrotate -Source2: apcupsd-httpd.conf -Source3: apcupsd64x64.png -Patch0: apcupsd-3.14.3-init.patch -Patch1: apcupsd-3.14.4-shutdown.patch - -# systemd support -Patch3: apcupsd-3.14.8-systemd.patch +Name: apcupsd +Version: 3.14.14 +Release: 2%{?dist} +Summary: APC UPS Power Control Daemon + +License: GPLv2 +URL: http://www.apcupsd.com +Source0: https://downloads.sourceforge.net/apcupsd/apcupsd-%version.tar.gz +Source1: apcupsd.service +Source2: apcupsd_shutdown +Source3: apcupsd-httpd.conf +Source4: apcupsd.logrotate +Source5: apcupsd64x64.png # fix crash in gui, rhbz#578276 -Patch4: apcupsd-3.14.9-fixgui.patch +Patch0: apcupsd-3.14.9-fixgui.patch BuildRequires: glibc-devel, gd-devel BuildRequires: net-snmp-devel, tcp_wrappers-devel, libusb-devel @@ -60,8 +57,8 @@ A GUI interface to the APC UPS monitoring daemon. %prep %autosetup -p1 -#we will handle fedora/redhat part ourselves -printf 'install:\n\techo skipped\n' >platforms/redhat/Makefile +# Override the provided platform makefile +printf 'install:\n\techo skipped\n' > platforms/redhat/Makefile %build %global _hardened_build 1 @@ -98,15 +95,16 @@ make DESTDIR=%buildroot install install -m744 platforms/apccontrol \ %buildroot/etc/apcupsd/apccontrol -# systemd support -install -p -D -m644 apcupsd.service %buildroot/lib/systemd/system/apcupsd.service -install -p -D -m755 apcupsd_shutdown %buildroot/lib/systemd/system-shutdown/apcupsd_shutdown +install -p -D -m644 %SOURCE1 %buildroot/lib/systemd/system/apcupsd.service +install -p -D -m755 %SOURCE2 %buildroot/lib/systemd/system-shutdown/apcupsd_shutdown -install -d %buildroot/etc/logrotate.d -install -m0644 %SOURCE1 %buildroot/etc/logrotate.d/apcupsd -install -d %buildroot/etc/httpd/conf.d -install -m0644 %SOURCE2 %buildroot/etc/httpd/conf.d/apcupsd.conf -install -D -m0644 %SOURCE3 %buildroot/usr/share/pixmaps/apcupsd64x64.png +#install -d %buildroot/etc/httpd/conf.d +install -p -D -m0644 %SOURCE3 %buildroot/etc/httpd/conf.d/apcupsd.conf + +#install -d %buildroot/etc/logrotate.d +install -p -D -m0644 %SOURCE4 %buildroot/etc/logrotate.d/apcupsd + +install -p -D -m0644 %SOURCE5 %buildroot/usr/share/pixmaps/apcupsd64x64.png desktop-file-install \ --vendor="fedora" \ @@ -169,6 +167,12 @@ rm examples/*.in %changelog * Wed Jun 22 2016 Jason L Tibbitts III - 3.14.14-2 - Clean up the spec a bit. +- I've no idea why the unit file and shutdown script were added in a patch. + The unit file also used network.target instead of network-online.target. +- Remove apcupsd-3.14.4-shutdown.patch. I have no idea why it was there, as + "shutdown -h now" should be hust fine, while "-h -H now" is both + contradictory and should just leave the machine halted but running, which + doesn't make much sense. * Thu Jun 02 2016 Michal Hlavinka - 3.14.14-1 - updated to 3.14.14 diff --git a/apcupsd_shutdown b/apcupsd_shutdown new file mode 100644 index 0000000..4eff1ed --- /dev/null +++ b/apcupsd_shutdown @@ -0,0 +1,9 @@ +#!/bin/sh + +# See if this is a powerfail situation. +if [ -f /etc/apcupsd/powerfail ]; then + echo + echo "APCUPSD will now power off the UPS" + echo + /etc/apcupsd/apccontrol killpower +fi