[apcupsd/f15] add script for shutdown in systemd environment (#346271)

Michal Hlavinka mhlavink at fedoraproject.org
Thu Jun 16 11:37:37 UTC 2011


commit ff74f8a19fbf0a04b7b116883b0ae0c3aba1e49d
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Thu Jun 16 13:37:25 2011 +0200

    add script for shutdown in systemd environment (#346271)

 apcupsd-3.14.8-systemdshutdown.patch |   13 +++++++++++++
 apcupsd.spec                         |   15 +++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/apcupsd-3.14.8-systemdshutdown.patch b/apcupsd-3.14.8-systemdshutdown.patch
new file mode 100644
index 0000000..2a6f6e8
--- /dev/null
+++ b/apcupsd-3.14.8-systemdshutdown.patch
@@ -0,0 +1,13 @@
+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.spec b/apcupsd.spec
index f8cd122..f034442 100644
--- a/apcupsd.spec
+++ b/apcupsd.spec
@@ -1,6 +1,6 @@
 Name:         apcupsd
 Version:      3.14.8
-Release:      7%{?dist}
+Release:      8%{?dist}
 Summary:      APC UPS Power Control Daemon for Linux
 
 Group:        System Environment/Daemons
@@ -9,13 +9,15 @@ URL:          http://www.apcupsd.com
 Source0:      http://downloads.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
 Source1:      apcupsd.logrotate
 Source2:      apcupsd-httpd.conf
-Source3:      README.Red_Hat
 Patch0:       apcupsd-3.14.3-init.patch
 Patch1:       apcupsd-3.14.4-shutdown.patch
 
 #fix FTBFS, c++ linking needs -lstdc++ explicitly
 Patch2:       apcupsd-3.14.8-cxxld.patch
 
+# halt script does not exist in systemd
+Patch3:       apcupsd-3.14.8-systemdshutdown.patch
+
 BuildRoot:    %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: glibc-devel >= 2.3, gd-devel > 2.0
@@ -63,10 +65,10 @@ A GUI interface to the APC UPS monitoring daemon.
 %patch0 -p1 -b .init
 %patch1 -p1 -b .shutdown
 %patch2 -p1 -b .cxxld
+%patch3 -p1 -b .systemd
 
 #we will handle fedora/redhat part ourselfs
 printf 'install:\n\techo skipped\n' >platforms/redhat/Makefile
-install -p -m 0666 %{SOURCE3} .
 
 %build
 cp -p /usr/lib/rpm/config.{guess,sub} autoconf/
@@ -106,6 +108,7 @@ install -m744 platforms/apccontrol \
               $RPM_BUILD_ROOT%{_sysconfdir}/apcupsd/apccontrol
 
 install -m755 platforms/redhat/apcupsd $RPM_BUILD_ROOT%{_initrddir}
+install -m755 -p -D apcupsd_shutdown $RPM_BUILD_ROOT/lib/systemd/system-shutdown/apcupsd_shutdown
 
 install -d %{buildroot}%{_sysconfdir}/logrotate.d
 install -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
@@ -128,9 +131,10 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root,-)
-%doc COPYING ChangeLog examples ReleaseNotes README.Red_Hat
+%doc COPYING ChangeLog examples ReleaseNotes
 %dir %{_sysconfdir}/apcupsd
 %{_initddir}/apcupsd
+/lib/systemd/system-shutdown/apcupsd_shutdown
 %config(noreplace) %{_sysconfdir}/apcupsd/apcupsd.conf
 %attr(0755,root,root) %{_sysconfdir}/apcupsd/apccontrol
 %config(noreplace) %{_sysconfdir}/apcupsd/changeme
@@ -179,6 +183,9 @@ fi
 
 
 %changelog
+* Thu Jun 16 2011 Michal Hlavinka <mhlavink at redhat.com> - 3.14.8-8
+- add script for shutdown in systemd environment (#346271)
+
 * Wed Feb 09 2011 Michal Hlavinka <mhlavink at redhat.com> - 3.14.9-7
 - add readme file to doc explaining needed configuration of halt script
 


More information about the scm-commits mailing list