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