]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without cgi # without CGI program support | |
4 | %bcond_without gapcmon # without gapcmon GUI | |
5 | %bcond_without net # without network support | |
6 | %bcond_with snmp # with SNMP support | |
7 | %bcond_without test # without TEST support | |
8 | %bcond_without usb # without USB support | |
9 | # | |
10 | Summary: Power management software for APC UPS hardware | |
11 | Summary(pl.UTF-8): Oprogramowanie do zarządzania energią dla UPS-ów APC | |
12 | Name: apcupsd | |
13 | Version: 3.14.3 | |
14 | Release: 1 | |
15 | License: GPL v2 | |
16 | Group: Networking/Daemons | |
17 | Source0: http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz | |
18 | # Source0-md5: a212351d21828e9344264614c7ad8ba1 | |
19 | Source1: %{name}.init | |
20 | Source2: %{name}.logrotate | |
21 | Source3: %{name}.sysconfig | |
22 | Patch0: %{name}-configure.patch | |
23 | URL: http://www.apcupsd.com/ | |
24 | BuildRequires: autoconf | |
25 | %{?with_gapcmon: BuildRequires: gconfmm-devel} | |
26 | BuildRequires: gettext-devel | |
27 | BuildRequires: ncurses-ext-devel | |
28 | %{?with_snmp: BuildRequires: net-snmp-devel} | |
29 | BuildRequires: rpmbuild(macros) >= 1.268 | |
30 | Requires(post): fileutils | |
31 | Requires(post,preun): /sbin/chkconfig | |
32 | Requires: rc-scripts | |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
34 | ||
35 | %define _sysconfdir /etc/apcupsd | |
36 | %define _cgidir /home/services/httpd/cgi-bin | |
37 | ||
38 | %description | |
39 | UPS power management under Linux for APCC Products. It allows your | |
40 | computer/server to run during power problems for a specified length of | |
41 | time or the life of the batteries in your BackUPS, BackUPS Pro, | |
42 | SmartUPS v/s, or SmartUPS, and then properly executes a controlled | |
43 | shutdown during an extended power failure. | |
44 | ||
45 | %description -l pl.UTF-8 | |
46 | Oprogramowanie do zarządzania energią dla UPS-ów APC. Pozwala | |
47 | komputerowi działać po awarii zasilania przez określony czas lub czas | |
48 | życia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz | |
49 | odpowiednio uruchamia kontrolowany shutdown przy dłuższej awarii | |
50 | zasilania. | |
51 | ||
52 | %package cgi | |
53 | Summary: upsstats - Web-based UPS status viewer | |
54 | Summary(pl.UTF-8): upsstats - oparta na WWW przeglądarka stanu UPS-a | |
55 | Group: Applications/Networking | |
56 | Requires: webserver | |
57 | ||
58 | %description cgi | |
59 | upsstats.cgi builds a lightweight web page containing basic UPS status | |
60 | information. | |
61 | ||
62 | %description cgi -l pl.UTF-8 | |
63 | upsstats.cgi tworzy lekką stronę WWW zawierającą podstawowe informacje | |
64 | o stanie UPS-a. | |
65 | ||
66 | %package gapcmon | |
67 | Summary: Apcupsd GUI monitoring application | |
68 | Summary(pl.UTF-8): Aplikacja GUI monitorowania Apcupsd | |
69 | Group: X11/Applications | |
70 | ||
71 | %description gapcmon | |
72 | GNOME/GTK+ based application which integrates into most desktop panels | |
73 | (not just GNOME). It monitors one or more Apcupsd instances using | |
74 | Apcupsd's NIS networking server. The status of each UPS is shown with | |
75 | a icon. | |
76 | ||
77 | %description gapcmon -l pl.UTF-8 | |
78 | Oparta na GNOME/GTK+ aplikacja, która integruje się z panelami (nie | |
79 | tylko Gnome). Monitoruje jedną bądź kilka instancji Apcupsd za pomocą | |
80 | serwera NIS. Status każdego UPS-a przedstawia ikona. | |
81 | ||
82 | %prep | |
83 | %setup -q | |
84 | %patch0 -p1 | |
85 | for i in configure.in aclocal.m4 config.h.in; do install autoconf/$i .;done | |
86 | cp -f %{_datadir}/automake/config.sub autoconf | |
87 | ||
88 | %build | |
89 | %{__autoconf} | |
90 | %configure \ | |
91 | --with-log-dir=%{_var}/log \ | |
92 | --with-stat-dir=%{_var}/lib/apcupsd \ | |
93 | %if %{with cgi} | |
94 | --enable-cgi \ | |
95 | --with-cgi-bin=/home/services/httpd/cgi-bin \ | |
96 | %endif | |
97 | %{?with_test:--enable-test} \ | |
98 | %if %{with net} | |
99 | --enable-net \ | |
100 | %endif | |
101 | --enable-nls \ | |
102 | --enable-powerflute \ | |
103 | %{?with_gapcmon:--enable-gapcmon} \ | |
104 | %{?with_snmp:--enable-snmp} \ | |
105 | %{?with_usb:--enable-usb} | |
106 | ||
107 | %{__make} | |
108 | ||
109 | %install | |
110 | rm -rf $RPM_BUILD_ROOT | |
111 | install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d,sysconfig} \ | |
112 | $RPM_BUILD_ROOT/var/{log,lib/apcupsd} | |
113 | ||
114 | %{__make} install \ | |
115 | DESTDIR=$RPM_BUILD_ROOT | |
116 | ||
117 | install src/powerflute $RPM_BUILD_ROOT%{_sbindir} | |
118 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd | |
119 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd | |
120 | install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/apcupsd | |
121 | ||
122 | touch $RPM_BUILD_ROOT/var/log/apcupsd.events | |
123 | touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status | |
124 | ||
125 | cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF | |
126 | #!/bin/sh | |
127 | /etc/rc.d/init.d/apcupsd powerdown | |
128 | EOF | |
129 | ||
130 | %clean | |
131 | rm -rf $RPM_BUILD_ROOT | |
132 | ||
133 | %post | |
134 | /sbin/chkconfig --add apcupsd | |
135 | %service apcupsd restart "apcupsd daemon" | |
136 | ||
137 | %preun | |
138 | if [ "$1" = "0" ]; then | |
139 | %service apcupsd stop | |
140 | /sbin/chkconfig --del apcupsd | |
141 | fi | |
142 | ||
143 | %files | |
144 | %defattr(644,root,root,755) | |
145 | %doc ChangeLog Developers | |
146 | %attr(755,root,root) %{_sbindir}/* | |
147 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apcupsd.conf | |
148 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/apcupsd | |
149 | %attr(754,root,root) %{_sysconfdir}/apccontrol | |
150 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/changeme | |
151 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commfailure | |
152 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commok | |
153 | #%attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mainsback | |
154 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/onbattery | |
155 | %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/offbattery | |
156 | %if %{with cgi} | |
157 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf | |
158 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/multimon.conf | |
159 | %{_sysconfdir}/apcupsd.css | |
160 | %endif | |
161 | %attr(754,root,root) /etc/rc.d/init.d/apcupsd | |
162 | %attr(754,root,root) /etc/rc.d/init.d/halt | |
163 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/apcupsd | |
164 | %dir %{_sysconfdir} | |
165 | %dir /var/lib/apcupsd | |
166 | %attr(640,root,root) %ghost /var/log/apcupsd.events | |
167 | %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status | |
168 | %{_mandir}/man8/apcupsd.* | |
169 | ||
170 | %if %{with cgi} | |
171 | %files cgi | |
172 | %defattr(644,root,root,755) | |
173 | %attr(755,root,root) %{_cgidir}/*.cgi | |
174 | %endif | |
175 | ||
176 | %if %{with gapcmon} | |
177 | %files gapcmon | |
178 | %defattr(644,root,root,755) | |
179 | %attr(755,root,root) %{_bindir}/* | |
180 | %{_desktopdir}/gapcmon.desktop | |
181 | %{_pixmapsdir}/* | |
182 | %endif |