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