2 # - update paths and pld patches
3 # - avoid messing in halt script in %post
4 Summary: Power management software for APC UPS hardware
5 Summary(pl): Oprogramowanie do zarz±dzania energi± dla UPS-ów APC
10 Group: Networking/Daemons
11 Source0: http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
12 # Source0-md5: f182db64c8acdae18f896ecdc064a239
13 Patch0: %{name}-paths.patch
14 Patch1: %{name}-pld.patch
15 #Patch1: apcups-makefile.patch
16 #Patch2: %{name}-Makefile-fix.patch
17 URL: http://www.apcupsd.com/
18 Requires(post,preun): /sbin/chkconfig
19 Requires(post): fileutils
20 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
22 %define _sysconfdir /etc/apcupsd
25 UPS power management under Linux for APCC Products. It allows your
26 computer/server to run during power problems for a specified length of
27 time or the life of the batteries in your BackUPS, BackUPS Pro,
28 SmartUPS v/s, or SmartUPS, and then properly executes a controlled
29 shutdown during an extended power failure.
32 Oprogramowanie do zarz±dzania energi± dla UPS-ów APC. Pozwala
33 komputerowi dzia³aæ po awarii zasilania przez okre¶lony czas lub czas
34 ¿ycia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz
35 odpowiednio uruchamia kontrolowany shutdown przy d³u¿szej awarii
40 #%patch0 -p1 -- configure should be patched to move files from /var/log to /var/lib
41 #%patch1 -p1 -- probably should be updated
49 rm -rf $RPM_BUILD_ROOT
50 #install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/var/log,/var/lib/apcupsd}
53 DESTDIR=$RPM_BUILD_ROOT
55 install platforms/redhat/apcupsd $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
56 #install platforms/pld/apcupsd $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
58 touch $RPM_BUILD_ROOT/var/log/apcupsd.log
59 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
60 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.events
63 rm -rf $RPM_BUILD_ROOT
66 /sbin/chkconfig --add apcupsd
68 #if !(grep /sbin/powersc /etc/rc.d/init.d/halt > /dev/null); then
69 cp -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.rpmorig
70 #sed -e '/# Now halt or reboot./i\' \
72 # See if this is a powerfail situation.\
75 if [ -f /etc/apcupsd/powerfail ]; then\
76 echo "APCUPSD to the Rescue!"\
78 /etc/apcupsd/apccontrol killpower \
83 ' > /etc/rc.d/init.d/halt
84 #' /etc/rc.d/init.d/halt.rpmorig > /etc/rc.d/init.d/halt
86 chmod 754 /etc/rc.d/init.d/halt
89 if [ "$1" = "0" ]; then
90 /sbin/chkconfig --del apcupsd
94 %defattr(644,root,root,755)
95 %doc ChangeLog Developers doc/{README.apcaccess,developers_manual,home-page,logo,manual}
96 %{_mandir}/man8/apcupsd.*
97 %attr(755,root,root) %{_sbindir}/*
98 #%attr(755,root,root) %config /sbin/powersc
99 %attr(640,root,root) %config(noreplace) %{_sysconfdir}/apcupsd.conf
100 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
101 %ghost /var/log/apcupsd.log
102 %ghost /var/lib/apcupsd/apcupsd.status
103 %ghost /var/lib/apcupsd/apcupsd.events