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