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