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