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: b69ccf4f4196582ab3e26bf6af937610
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
54 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
55 install platforms/unknown/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 mkdir -p $RPM_BUILD_ROOT/var/log
59 mkdir -p $RPM_BUILD_ROOT/var/lib/apcupsd
60 touch $RPM_BUILD_ROOT/var/log/apcupsd.log
61 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
62 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.events
63 mkdir -p $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}
66 rm -rf $RPM_BUILD_ROOT
69 /sbin/chkconfig --add apcupsd
71 #if !(grep /sbin/powersc /etc/rc.d/init.d/halt > /dev/null); then
72 cp -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.rpmorig
73 #sed -e '/# Now halt or reboot./i\' \
75 # See if this is a powerfail situation.\
78 if [ -f /etc/apcupsd/powerfail ]; then\
79 echo "APCUPSD to the Rescue!"\
81 /etc/apcupsd/apccontrol killpower \
86 ' > /etc/rc.d/init.d/halt
87 #' /etc/rc.d/init.d/halt.rpmorig > /etc/rc.d/init.d/halt
89 chmod 754 /etc/rc.d/init.d/halt
92 if [ "$1" = "0" ]; then
93 /sbin/chkconfig --del apcupsd
97 %defattr(644,root,root,755)
98 %doc ChangeLog Developers doc/{README.apcaccess,developers_manual,home-page,logo}
99 %{_mandir}/man8/apcupsd.*
100 %attr(755,root,root) %{_sbindir}/*
101 #%attr(755,root,root) %config /sbin/powersc
102 %attr(640,root,root) %config(noreplace) %{_sysconfdir}/apcupsd.conf
103 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
104 %ghost /var/log/apcupsd.log
105 %ghost /var/lib/apcupsd/apcupsd.status
106 %ghost /var/lib/apcupsd/apcupsd.events