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 Source10: %{name}-rc.d-halt
13 # Source0-md5: b69ccf4f4196582ab3e26bf6af937610
14 Patch0: %{name}-paths.patch
15 Patch1: %{name}-pld.patch
16 #Patch1: apcups-makefile.patch
17 #Patch2: %{name}-Makefile-fix.patch
18 URL: http://www.apcupsd.com/
19 Requires(post,preun): /sbin/chkconfig
20 Requires(post): fileutils
21 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
23 %define _sysconfdir /etc/apcupsd
26 UPS power management under Linux for APCC Products. It allows your
27 computer/server to run during power problems for a specified length of
28 time or the life of the batteries in your BackUPS, BackUPS Pro,
29 SmartUPS v/s, or SmartUPS, and then properly executes a controlled
30 shutdown during an extended power failure.
33 Oprogramowanie do zarz±dzania energi± dla UPS-ów APC. Pozwala
34 komputerowi dzia³aæ po awarii zasilania przez okre¶lony czas lub czas
35 ¿ycia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz
36 odpowiednio uruchamia kontrolowany shutdown przy d³u¿szej awarii
42 #-- configure should be patched to move files from /var/log to /var/lib
44 #-- probably should be updated
52 rm -rf $RPM_BUILD_ROOT
53 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/var/log,/var/lib/apcupsd,\
57 DESTDIR=$RPM_BUILD_ROOT
58 install platforms/unknown/apcupsd $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
59 #install platforms/pld/apcupsd $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
60 install %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/halt-apcupsd
62 mkdir -p $RPM_BUILD_ROOT/var/log
63 mkdir -p $RPM_BUILD_ROOT/var/lib/apcupsd
64 touch $RPM_BUILD_ROOT/var/log/apcupsd.log
65 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
66 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.events
67 mkdir -p $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}
70 rm -rf $RPM_BUILD_ROOT
73 /sbin/chkconfig --add apcupsd
75 #if !(grep /sbin/powersc /etc/rc.d/init.d/halt > /dev/null); then
76 cp -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.rpmorig
77 ln -s /etc/rc.d/init.d/halt-apcupsd /etc/rc.d/init.d/halt
78 #sed -e '/# Now halt or reboot./i\' \
80 # See if this is a powerfail situation.\
82 #' /etc/rc.d/init.d/halt.rpmorig > /etc/rc.d/init.d/halt
86 if [ "$1" = "0" ]; then
87 /sbin/chkconfig --del apcupsd
91 %defattr(644,root,root,755)
92 %doc ChangeLog Developers doc/{README.apcaccess,developers_manual,home-page,logo}
93 %{_mandir}/man8/apcupsd.*
94 %attr(755,root,root) %{_sbindir}/*
95 #%attr(755,root,root) %config /sbin/powersc
96 %attr(640,root,root) %config(noreplace) %{_sysconfdir}/*
97 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
98 %attr(754,root,root) /etc/rc.d/init.d/halt-apcupsd
99 %ghost /var/log/apcupsd.log
100 %ghost /var/lib/apcupsd/apcupsd.status
101 %ghost /var/lib/apcupsd/apcupsd.events