]> git.pld-linux.org Git - packages/apcupsd.git/blob - apcupsd.spec
- updated to 3.14.14, adjusted configure patch for current autotools
[packages/apcupsd.git] / apcupsd.spec
1 #
2 # Conditional build:
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
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.14
14 Release:        1
15 License:        GPL v2
16 Group:          Networking/Daemons
17 Source0:        https://downloads.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
18 # Source0-md5:  cc8f5ced77f38906a274787acb9bc980
19 Source1:        %{name}.init
20 Source2:        %{name}.logrotate
21 Source3:        %{name}.sysconfig
22 Patch0:         %{name}-configure.patch
23 Patch1:         control-config.patch
24 Patch2:         format-security.patch
25 Patch3:         shutdown.patch
26 Patch4:         cxxld.patch
27 Patch5:         systemd.patch
28 Patch6:         fixgui.patch
29 Patch7:         nodbg.patch
30 URL:            http://www.apcupsd.com/
31 %{?with_gapcmon:BuildRequires:  GConf2-devel >= 2.0}
32 BuildRequires:  autoconf
33 BuildRequires:  automake
34 BuildRequires:  gd-devel
35 %{?with_gapcmon:BuildRequires:  gtk+2-devel >= 2:2.4.0}
36 BuildRequires:  libstdc++-devel
37 BuildRequires:  libwrap-devel
38 BuildRequires:  man-db
39 %{?with_snmp:BuildRequires:     net-snmp-devel}
40 BuildRequires:  pkgconfig
41 BuildRequires:  rpmbuild(macros) >= 1.647
42 BuildRequires:  util-linux
43 Requires:       rc-scripts
44 Requires:       systemd-units >= 0.38
45 Requires(post): fileutils
46 Requires(post,preun):   /sbin/chkconfig
47 Requires(post,preun,postun):    systemd-units >= 38
48 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 %define         _sysconfdir     /etc/apcupsd
51 %define         _cgidir         /home/services/httpd/cgi-bin
52
53 %description
54 UPS power management under Linux for APCC Products. It allows your
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.
59
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
65 zasilania.
66
67 %package cgi
68 Summary:        upsstats - Web-based UPS status viewer
69 Summary(pl.UTF-8):      upsstats - oparta na WWW przeglądarka stanu UPS-a
70 Group:          Applications/Networking
71 Requires:       webserver
72
73 %description cgi
74 upsstats.cgi builds a lightweight web page containing basic UPS status
75 information.
76
77 %description cgi -l pl.UTF-8
78 upsstats.cgi tworzy lekką stronę WWW zawierającą podstawowe informacje
79 o stanie UPS-a.
80
81 %package gapcmon
82 Summary:        Apcupsd GUI monitoring application
83 Summary(pl.UTF-8):      Aplikacja GUI monitorowania Apcupsd
84 Group:          X11/Applications
85 URL:            https://gapcmon.sourceforge.net/
86 Requires:       gtk+2 >= 2:2.4.0
87
88 %description gapcmon
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.
93
94 %description gapcmon -l pl.UTF-8
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.
98
99 %prep
100 %setup -q
101 %patch0 -p1
102 %patch1 -p1
103 %patch2 -p1
104 %patch3 -p1
105 %patch4 -p1
106 %patch5 -p1
107 %patch6 -p1
108 %patch7 -p1
109
110 %build
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
115 %{__autoconf}
116 %configure \
117         APCUPSD_MAIL="/bin/mail" \
118         SHUTDOWN="/sbin/shutdown" \
119         WALL="%{_bindir}/wall" \
120         --with-libwrap \
121         --with-log-dir=%{_var}/log \
122         --with-stat-dir=%{_var}/lib/apcupsd \
123         --enable-apcsmart \
124 %if %{with cgi}
125         --enable-cgi \
126         --with-cgi-bin=/home/services/httpd/cgi-bin \
127 %endif
128         --enable-dumb \
129         %{?with_gapcmon:--enable-gapcmon} \
130         %{?with_net:--enable-net} \
131         --enable-pcnet \
132         %{?with_snmp:--enable-snmp} \
133         %{?with_test:--enable-test} \
134         %{?with_usb:--enable-usb}
135
136 %{__make} \
137         VERBOSE=2
138
139 %install
140 rm -rf $RPM_BUILD_ROOT
141 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d,sysconfig} \
142         $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
143
144 %{__make} install \
145         DESTDIR=$RPM_BUILD_ROOT
146
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
150
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
155 touch $RPM_BUILD_ROOT/var/log/apcupsd.events
156 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
157
158 cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF
159 #!/bin/sh
160 exec /etc/rc.d/init.d/apcupsd powerdown
161 EOF
162
163 # no hal
164 %{__rm} $RPM_BUILD_ROOT%{_datadir}/hal/fdi/policy/20thirdparty/80-apcupsd-ups-policy.fdi
165
166 %clean
167 rm -rf $RPM_BUILD_ROOT
168
169 %post
170 /sbin/chkconfig --add apcupsd
171 %service apcupsd restart "apcupsd daemon"
172 %systemd_post %{name}.service
173
174 %preun
175 if [ "$1" = "0" ]; then
176         %service apcupsd stop
177         /sbin/chkconfig --del apcupsd
178 fi
179 %systemd_preun %{name}.service
180
181 %postun
182 %systemd_reload
183
184 %files
185 %defattr(644,root,root,755)
186 %doc ChangeLog Developers ReleaseNotes
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
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
193 %attr(754,root,root) %{_sysconfdir}/apccontrol
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
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
200 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
201 %attr(754,root,root) /etc/rc.d/init.d/halt
202 %{systemdunitdir}/%{name}.service
203 %attr(755,root,root) %{systemdunitdir}-shutdown/apcupsd_shutdown
204 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/apcupsd
205 %dir %{_sysconfdir}
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
209 %{_mandir}/man8/apcupsd.8*
210 %{_mandir}/man8/apctest.8*
211 %{_mandir}/man8/apcaccess.8*
212 %{_mandir}/man8/apccontrol.8*
213 %{_mandir}/man5/apcupsd.conf.5*
214
215 %if %{with cgi}
216 %files cgi
217 %defattr(644,root,root,755)
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
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
225 %endif
226
227 %if %{with gapcmon}
228 %files gapcmon
229 %defattr(644,root,root,755)
230 %attr(755,root,root) %{_bindir}/gapcmon
231 %{_desktopdir}/gapcmon.desktop
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
238 %endif
This page took 0.074709 seconds and 4 git commands to generate.