]>
Commit | Line | Data |
---|---|---|
79f87cb5 AA |
1 | # |
2 | # Conditional build: | |
2fab7262 TP |
3 | %bcond_without cgi # without CGI program support |
4 | %bcond_without gapcmon # without gapcmon GUI | |
d8ccf3e8 | 5 | %bcond_without net # without network support |
6 | %bcond_with snmp # with SNMP support | |
2fab7262 TP |
7 | %bcond_without test # without TEST support |
8 | %bcond_without usb # without USB support | |
b0cabf4c | 9 | |
1a2f2291 | 10 | Summary: Power management software for APC UPS hardware |
f755a48e | 11 | Summary(pl.UTF-8): Oprogramowanie do zarządzania energią dla UPS-ów APC |
82761b0b | 12 | Name: apcupsd |
291cd762 | 13 | Version: 3.14.13 |
d483a270 | 14 | Release: 1 |
82761b0b | 15 | License: GPL v2 |
6a96dc52 | 16 | Group: Networking/Daemons |
1cc974df | 17 | Source0: http://downloads.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz |
291cd762 | 18 | # Source0-md5: c291d9d3923b4d9c0e600b755ad4f489 |
79f87cb5 AA |
19 | Source1: %{name}.init |
20 | Source2: %{name}.logrotate | |
9a2c1151 | 21 | Source3: %{name}.sysconfig |
79f87cb5 | 22 | Patch0: %{name}-configure.patch |
d483a270 | 23 | |
4ed79b55 | 24 | Patch2: format-security.patch |
76fc6305 ER |
25 | Patch3: shutdown.patch |
26 | Patch4: cxxld.patch | |
27 | Patch5: systemd.patch | |
28 | Patch6: fixgui.patch | |
29 | Patch7: nodbg.patch | |
d5bc45da | 30 | URL: http://www.apcupsd.com/ |
2cfbae37 | 31 | %{?with_gapcmon:BuildRequires: GConf2-devel >= 2.0} |
23d673ff | 32 | BuildRequires: autoconf |
364fab20 | 33 | BuildRequires: automake |
34 | BuildRequires: gd-devel | |
2cfbae37 | 35 | %{?with_gapcmon:BuildRequires: gtk+2-devel >= 2:2.4.0} |
4ed79b55 | 36 | BuildRequires: man-db |
2cfbae37 JB |
37 | %{?with_snmp:BuildRequires: net-snmp-devel} |
38 | BuildRequires: pkgconfig | |
76fc6305 | 39 | BuildRequires: rpmbuild(macros) >= 1.647 |
2caf2249 | 40 | BuildRequires: util-linux |
76fc6305 ER |
41 | Requires: systemd-units >= 0.38 |
42 | Requires: rc-scripts | |
5bb78d9f | 43 | Requires(post): fileutils |
232188ee | 44 | Requires(post,preun): /sbin/chkconfig |
76fc6305 | 45 | Requires(post,preun,postun): systemd-units >= 38 |
9860ec16 | 46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
03dfd68e | 47 | |
1d49e6a6 | 48 | %define _sysconfdir /etc/apcupsd |
502a8f9c | 49 | %define _cgidir /home/services/httpd/cgi-bin |
2534c785 | 50 | |
03dfd68e | 51 | %description |
82761b0b | 52 | UPS power management under Linux for APCC Products. It allows your |
6a96dc52 | 53 | computer/server to run during power problems for a specified length of |
54 | time or the life of the batteries in your BackUPS, BackUPS Pro, | |
55 | SmartUPS v/s, or SmartUPS, and then properly executes a controlled | |
56 | shutdown during an extended power failure. | |
03dfd68e | 57 | |
c69e54dd JR |
58 | %description -l pl.UTF-8 |
59 | Oprogramowanie do zarządzania energią dla UPS-ów APC. Pozwala | |
60 | komputerowi działać po awarii zasilania przez określony czas lub czas | |
61 | życia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz | |
62 | odpowiednio uruchamia kontrolowany shutdown przy dłuższej awarii | |
7ff8ac4b JB |
63 | zasilania. |
64 | ||
364fab20 | 65 | %package cgi |
86fcc136 | 66 | Summary: upsstats - Web-based UPS status viewer |
f755a48e | 67 | Summary(pl.UTF-8): upsstats - oparta na WWW przeglądarka stanu UPS-a |
86fcc136 | 68 | Group: Applications/Networking |
69 | Requires: webserver | |
80be390e MW |
70 | |
71 | %description cgi | |
36dc352e JB |
72 | upsstats.cgi builds a lightweight web page containing basic UPS status |
73 | information. | |
74 | ||
c69e54dd JR |
75 | %description cgi -l pl.UTF-8 |
76 | upsstats.cgi tworzy lekką stronę WWW zawierającą podstawowe informacje | |
36dc352e | 77 | o stanie UPS-a. |
80be390e | 78 | |
270d92b6 TP |
79 | %package gapcmon |
80 | Summary: Apcupsd GUI monitoring application | |
81 | Summary(pl.UTF-8): Aplikacja GUI monitorowania Apcupsd | |
82 | Group: X11/Applications | |
b0cabf4c | 83 | URL: http://gapcmon.sourceforge.net/ |
270d92b6 TP |
84 | |
85 | %description gapcmon | |
0a602502 JB |
86 | GNOME/GTK+ based application which integrates into most desktop panels |
87 | (not just GNOME). It monitors one or more Apcupsd instances using | |
88 | Apcupsd's NIS networking server. The status of each UPS is shown with | |
89 | a icon. | |
270d92b6 TP |
90 | |
91 | %description gapcmon -l pl.UTF-8 | |
0a602502 JB |
92 | Oparta na GNOME/GTK+ aplikacja, która integruje się z panelami (nie |
93 | tylko Gnome). Monitoruje jedną bądź kilka instancji Apcupsd za pomocą | |
94 | serwera NIS. Status każdego UPS-a przedstawia ikona. | |
270d92b6 | 95 | |
03dfd68e | 96 | %prep |
e6609c22 | 97 | %setup -q |
5d58544c | 98 | %patch0 -p1 |
d483a270 | 99 | |
4ed79b55 | 100 | %patch2 -p1 |
76fc6305 ER |
101 | %patch3 -p1 |
102 | %patch4 -p1 | |
103 | %patch5 -p1 | |
104 | %patch6 -p1 | |
105 | %patch7 -p1 | |
03dfd68e | 106 | |
107 | %build | |
ff0f68ae ER |
108 | for i in configure.in aclocal.m4 config.h.in; do install autoconf/$i .;done |
109 | cp -f %{_datadir}/automake/config.sub autoconf | |
23d673ff | 110 | %{__autoconf} |
79f87cb5 | 111 | %configure \ |
364fab20 | 112 | APCUPSD_MAIL="/bin/mail" \ |
113 | SHUTDOWN="/sbin/shutdown" \ | |
114 | WALL="%{_bindir}/wall" \ | |
9ed364ac AA |
115 | --with-log-dir=%{_var}/log \ |
116 | --with-stat-dir=%{_var}/lib/apcupsd \ | |
f060f323 ER |
117 | --enable-apcsmart \ |
118 | --enable-dumb \ | |
119 | --enable-pcnet \ | |
80be390e MW |
120 | %if %{with cgi} |
121 | --enable-cgi \ | |
122 | --with-cgi-bin=/home/services/httpd/cgi-bin \ | |
80be390e | 123 | %endif |
9c3ad2b9 | 124 | %{?with_test:--enable-test} \ |
ff0f68ae | 125 | %{?with_net:--enable-net} \ |
2fab7262 | 126 | %{?with_gapcmon:--enable-gapcmon} \ |
d8ccf3e8 | 127 | %{?with_snmp:--enable-snmp} \ |
44319652 | 128 | %{?with_usb:--enable-usb} |
79f87cb5 | 129 | |
ff0f68ae ER |
130 | %{__make} \ |
131 | VERBOSE=2 | |
e6609c22 | 132 | |
03dfd68e | 133 | %install |
6a96dc52 | 134 | rm -rf $RPM_BUILD_ROOT |
f3858603 | 135 | install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d,sysconfig} \ |
79f87cb5 | 136 | $RPM_BUILD_ROOT/var/{log,lib/apcupsd} |
bb2476bb | 137 | |
d5bc45da JB |
138 | %{__make} install \ |
139 | DESTDIR=$RPM_BUILD_ROOT | |
270d92b6 | 140 | |
b0cabf4c ER |
141 | install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd |
142 | cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd | |
143 | cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/apcupsd | |
d5bc45da | 144 | |
76fc6305 ER |
145 | # systemd support |
146 | install -p -D apcupsd.service $RPM_BUILD_ROOT%{systemdunitdir}/apcupsd.service | |
147 | install -p -D apcupsd_shutdown $RPM_BUILD_ROOT%{systemdunitdir}-shutdown/apcupsd_shutdown | |
148 | ||
79f87cb5 | 149 | touch $RPM_BUILD_ROOT/var/log/apcupsd.events |
d5bc45da | 150 | touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status |
03dfd68e | 151 | |
9ed364ac AA |
152 | cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF |
153 | #!/bin/sh | |
b0cabf4c | 154 | exec /etc/rc.d/init.d/apcupsd powerdown |
9ed364ac AA |
155 | EOF |
156 | ||
b0cabf4c ER |
157 | # no hal |
158 | %{__rm} $RPM_BUILD_ROOT%{_datadir}/hal/fdi/policy/20thirdparty/80-apcupsd-ups-policy.fdi | |
159 | ||
03dfd68e | 160 | %clean |
7ff8ac4b | 161 | rm -rf $RPM_BUILD_ROOT |
03dfd68e | 162 | |
163 | %post | |
4a9afcae | 164 | /sbin/chkconfig --add apcupsd |
502a8f9c | 165 | %service apcupsd restart "apcupsd daemon" |
76fc6305 | 166 | %systemd_post %{name}.service |
bb2476bb | 167 | |
03dfd68e | 168 | %preun |
7ff8ac4b | 169 | if [ "$1" = "0" ]; then |
502a8f9c | 170 | %service apcupsd stop |
61e20730 | 171 | /sbin/chkconfig --del apcupsd |
7ff8ac4b | 172 | fi |
76fc6305 ER |
173 | %systemd_preun %{name}.service |
174 | ||
175 | %postun | |
176 | %systemd_reload | |
03dfd68e | 177 | |
178 | %files | |
82761b0b | 179 | %defattr(644,root,root,755) |
91aa732c | 180 | %doc ChangeLog Developers |
364fab20 | 181 | %attr(755,root,root) %{_sbindir}/apcaccess |
182 | %attr(755,root,root) %{_sbindir}/apctest | |
183 | %attr(755,root,root) %{_sbindir}/apcupsd | |
184 | %attr(755,root,root) %{_sbindir}/smtp | |
b9be4436 SP |
185 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apcupsd.conf |
186 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/apcupsd | |
79f87cb5 | 187 | %attr(754,root,root) %{_sysconfdir}/apccontrol |
9cbeab38 MWP |
188 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/changeme |
189 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commfailure | |
190 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commok | |
191 | #%attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mainsback | |
9cbeab38 MWP |
192 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/onbattery |
193 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/offbattery | |
e6609c22 | 194 | %attr(754,root,root) /etc/rc.d/init.d/apcupsd |
9ed364ac | 195 | %attr(754,root,root) /etc/rc.d/init.d/halt |
76fc6305 ER |
196 | %{systemdunitdir}/%{name}.service |
197 | %attr(755,root,root) %{systemdunitdir}-shutdown/apcupsd_shutdown | |
b9be4436 SP |
198 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/apcupsd |
199 | %dir %{_sysconfdir} | |
79f87cb5 AA |
200 | %dir /var/lib/apcupsd |
201 | %attr(640,root,root) %ghost /var/log/apcupsd.events | |
202 | %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status | |
2caf2249 | 203 | %{_mandir}/man8/apcupsd.8* |
c2ec4af9 | 204 | %{_mandir}/man8/apctest.8* |
205 | %{_mandir}/man8/apcaccess.8* | |
206 | %{_mandir}/man8/apccontrol.8* | |
207 | %{_mandir}/man5/apcupsd.conf.5* | |
80be390e | 208 | |
2fab7262 | 209 | %if %{with cgi} |
80be390e MW |
210 | %files cgi |
211 | %defattr(644,root,root,755) | |
c7c2580f ER |
212 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf |
213 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/multimon.conf | |
214 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apcupsd.css | |
80be390e | 215 | %attr(755,root,root) %{_cgidir}/*.cgi |
2fab7262 | 216 | %endif |
270d92b6 | 217 | |
2fab7262 | 218 | %if %{with gapcmon} |
270d92b6 TP |
219 | %files gapcmon |
220 | %defattr(644,root,root,755) | |
2cfbae37 | 221 | %attr(755,root,root) %{_bindir}/gapcmon |
270d92b6 | 222 | %{_desktopdir}/gapcmon.desktop |
2cfbae37 | 223 | %{_pixmapsdir}/*.png |
2fab7262 | 224 | %endif |