3 %bcond_with usb # with USB support
5 Summary: Power management software for APC UPS hardware
6 Summary(pl): Oprogramowanie do zarz±dzania energi± dla UPS-ów APC
11 Group: Networking/Daemons
12 Source0: http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
13 # Source0-md5: 4c35774d587c54276cf03926768ad551
15 Source2: %{name}.logrotate
16 Source10: %{name}-rc.d-halt
17 Patch0: %{name}-configure.patch
18 URL: http://www.apcupsd.com/
19 BuildRequires: autoconf
20 Requires(post,preun): /sbin/chkconfig
21 Requires(post): fileutils
22 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24 %define _sysconfdir /etc/apcupsd
27 UPS power management under Linux for APCC Products. It allows your
28 computer/server to run during power problems for a specified length of
29 time or the life of the batteries in your BackUPS, BackUPS Pro,
30 SmartUPS v/s, or SmartUPS, and then properly executes a controlled
31 shutdown during an extended power failure.
34 Oprogramowanie do zarz±dzania energi± dla UPS-ów APC. Pozwala
35 komputerowi dzia³aæ po awarii zasilania przez okre¶lony czas lub czas
36 ¿ycia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz
37 odpowiednio uruchamia kontrolowany shutdown przy d³u¿szej awarii
50 --with-log-dir=%{_var}/log \
51 --with-stat-dir=%{_var}/lib/apcupsd \
54 --with-serial-dev=/dev/usb/hiddev[0-15] \
62 rm -rf $RPM_BUILD_ROOT
63 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d} \
64 $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
67 DESTDIR=$RPM_BUILD_ROOT
68 install %{SOURCE10} $RPM_BUILD_ROOT/etc/rc.d/init.d/halt-apcupsd
69 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
70 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd
72 touch $RPM_BUILD_ROOT/var/log/apcupsd.events
73 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
76 rm -rf $RPM_BUILD_ROOT
79 if [ "$1" = "1" ]; then
80 /sbin/chkconfig --add apcupsd
81 if [ -e /etc/rc.d/init.d/halt ]; then
82 mv -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.rpmorig
84 ln -s /etc/rc.d/init.d/halt-apcupsd /etc/rc.d/init.d/halt
87 if [ -f /var/lock/subsys/apcupsd ]; then
88 /etc/rc.d/init.d/apcupsd restart >&2
90 echo "Run \"/etc/rc.d/init.d/apcupsd start\" to start apcupsd daemon."
94 if [ "$1" = "0" ]; then
95 if [ -f /var/lock/subsys/apcupsd ]; then
96 /etc/rc.d/init.d/apcupsd stop >&2
98 rm -f /etc/rc.d/init.d/halt
99 if [ -e /etc/rc.d/init.d/halt.rpmorig ]; then
100 mv -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.rpmorig
102 /sbin/chkconfig --del apcupsd
106 %defattr(644,root,root,755)
107 %doc ChangeLog Developers doc/{README.apcaccess,developers_manual,home-page,logo}
108 %{_mandir}/man8/apcupsd.*
109 %attr(755,root,root) %{_sbindir}/*
110 %attr(640,root,root) %config(noreplace) %{_sysconfdir}/apcupsd.conf
111 %attr(754,root,root) %{_sysconfdir}/apccontrol
112 %attr(754,root,root) %{_sysconfdir}/changeme
113 %attr(754,root,root) %{_sysconfdir}/commfailure
114 %attr(754,root,root) %{_sysconfdir}/commok
115 %attr(754,root,root) %{_sysconfdir}/mainsback
116 %attr(754,root,root) %{_sysconfdir}/masterconnect
117 %attr(754,root,root) %{_sysconfdir}/mastertimeout
118 %attr(754,root,root) %{_sysconfdir}/onbattery
119 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
120 %attr(754,root,root) /etc/rc.d/init.d/halt-apcupsd
121 %attr(640,root,root) /etc/logrotate.d/apcupsd
122 %dir /var/lib/apcupsd
123 %attr(640,root,root) %ghost /var/log/apcupsd.events
124 %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status