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 Patch0: %{name}-configure.patch
17 URL: http://www.apcupsd.com/
18 BuildRequires: autoconf
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
49 --with-log-dir=%{_var}/log \
50 --with-stat-dir=%{_var}/lib/apcupsd \
53 --with-serial-dev=/dev/usb/hiddev[0-15] \
61 rm -rf $RPM_BUILD_ROOT
62 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d} \
63 $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
66 DESTDIR=$RPM_BUILD_ROOT
68 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
69 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd
71 touch $RPM_BUILD_ROOT/var/log/apcupsd.events
72 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
74 cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF
76 /etc/rc.d/init.d/apcupsd powerdown
80 rm -rf $RPM_BUILD_ROOT
83 if [ "$1" = "1" ]; then
84 /sbin/chkconfig --add apcupsd
86 if [ -f /var/lock/subsys/apcupsd ]; then
87 /etc/rc.d/init.d/apcupsd restart >&2
89 echo "Run \"/etc/rc.d/init.d/apcupsd start\" to start apcupsd daemon."
93 if [ "$1" = "0" ]; then
94 if [ -f /var/lock/subsys/apcupsd ]; then
95 /etc/rc.d/init.d/apcupsd stop >&2
97 /sbin/chkconfig --del apcupsd
101 %defattr(644,root,root,755)
102 %doc ChangeLog Developers doc/{README.apcaccess,developers_manual,home-page,logo}
103 %{_mandir}/man8/apcupsd.*
104 %attr(755,root,root) %{_sbindir}/*
105 %attr(640,root,root) %config(noreplace) %{_sysconfdir}/apcupsd.conf
106 %attr(754,root,root) %{_sysconfdir}/apccontrol
107 %attr(754,root,root) %{_sysconfdir}/changeme
108 %attr(754,root,root) %{_sysconfdir}/commfailure
109 %attr(754,root,root) %{_sysconfdir}/commok
110 %attr(754,root,root) %{_sysconfdir}/mainsback
111 %attr(754,root,root) %{_sysconfdir}/masterconnect
112 %attr(754,root,root) %{_sysconfdir}/mastertimeout
113 %attr(754,root,root) %{_sysconfdir}/onbattery
114 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
115 %attr(754,root,root) /etc/rc.d/init.d/halt
116 %attr(640,root,root) /etc/logrotate.d/apcupsd
117 %dir /var/lib/apcupsd
118 %attr(640,root,root) %ghost /var/log/apcupsd.events
119 %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status