3 %bcond_without test # without TEST support
4 %bcond_with usb # with USB support
6 Summary: Power management software for APC UPS hardware
7 Summary(pl): Oprogramowanie do zarz±dzania energi± dla UPS-ów APC
12 Group: Networking/Daemons
13 Source0: http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
14 # Source0-md5: 07de8f7d7488b6ef91f128f51713f4ea
16 Source2: %{name}.logrotate
17 Source3: %{name}.sysconfig
18 Patch0: %{name}-configure.patch
19 URL: http://www.apcupsd.com/
20 BuildRequires: autoconf
21 BuildRequires: automake
22 Requires(post,preun): /sbin/chkconfig
23 Requires(post): fileutils
24 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
26 %define _sysconfdir /etc/apcupsd
29 UPS power management under Linux for APCC Products. It allows your
30 computer/server to run during power problems for a specified length of
31 time or the life of the batteries in your BackUPS, BackUPS Pro,
32 SmartUPS v/s, or SmartUPS, and then properly executes a controlled
33 shutdown during an extended power failure.
36 Oprogramowanie do zarz±dzania energi± dla UPS-ów APC. Pozwala
37 komputerowi dzia³aæ po awarii zasilania przez okre¶lony czas lub czas
38 ¿ycia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz
39 odpowiednio uruchamia kontrolowany shutdown przy d³u¿szej awarii
48 cp -f /usr/share/automake/config.sub .
53 --with-log-dir=%{_var}/log \
54 --with-stat-dir=%{_var}/lib/apcupsd \
55 %{?with_test:--enable-test} \
58 --with-serial-dev=/dev/usb/hiddev[0-15] \
66 rm -rf $RPM_BUILD_ROOT
67 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d,sysconfig} \
68 $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
71 DESTDIR=$RPM_BUILD_ROOT
73 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
74 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd
75 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/apcupsd
77 touch $RPM_BUILD_ROOT/var/log/apcupsd.events
78 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
80 cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF
82 /etc/rc.d/init.d/apcupsd powerdown
86 rm -rf $RPM_BUILD_ROOT
89 /sbin/chkconfig --add apcupsd
90 if [ -f /var/lock/subsys/apcupsd ]; then
91 /etc/rc.d/init.d/apcupsd restart >&2
93 echo "Run \"/etc/rc.d/init.d/apcupsd start\" to start apcupsd daemon."
97 if [ "$1" = "0" ]; then
98 if [ -f /var/lock/subsys/apcupsd ]; then
99 /etc/rc.d/init.d/apcupsd stop >&2
101 /sbin/chkconfig --del apcupsd
105 %defattr(644,root,root,755)
106 %doc ChangeLog Developers doc/{README.apcaccess,README.solaris}
107 %{_mandir}/man8/apcupsd.*
108 %attr(755,root,root) %{_sbindir}/*
109 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/apcupsd.conf
110 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/apcupsd
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
121 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/logrotate.d/apcupsd
123 %dir /var/lib/apcupsd
124 %attr(640,root,root) %ghost /var/log/apcupsd.events
125 %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status