]> git.pld-linux.org Git - packages/apcupsd.git/blob - apcupsd.spec
9c05181387d52e7156cc41b037cc65950007b293
[packages/apcupsd.git] / apcupsd.spec
1 #
2 # Conditional build:
3 %bcond_without  test    # without TEST support
4 %bcond_without  usb     # without USB support
5 %bcond_without  net     # without network support
6 %bcond_without  cgi     # with CGI program support
7 %bcond_with     snmp    # with SNMP support
8 #
9 Summary:        Power management software for APC UPS hardware
10 Summary(pl.UTF-8):      Oprogramowanie do zarządzania energią dla UPS-ów APC
11 Name:           apcupsd
12 Version:        3.12.4
13 Release:        1
14 License:        GPL v2
15 Group:          Networking/Daemons
16 Source0:        http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
17 # Source0-md5:  669c833ec02a2bc29fa98f845e5f5de5
18 Source1:        %{name}.init
19 Source2:        %{name}.logrotate
20 Source3:        %{name}.sysconfig
21 Patch0:         %{name}-configure.patch
22 URL:            http://www.apcupsd.com/
23 BuildRequires:  autoconf
24 %{?with_snmp:BuildRequires:     net-snmp-devel}
25 BuildRequires:  rpmbuild(macros) >= 1.268
26 Requires(post): fileutils
27 Requires(post,preun):   /sbin/chkconfig
28 Requires:       rc-scripts
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31 %define         _sysconfdir     /etc/apcupsd
32 %define         _cgidir         /home/services/httpd/cgi-bin
33
34 %description
35 UPS power management under Linux for APCC Products. It allows your
36 computer/server to run during power problems for a specified length of
37 time or the life of the batteries in your BackUPS, BackUPS Pro,
38 SmartUPS v/s, or SmartUPS, and then properly executes a controlled
39 shutdown during an extended power failure.
40
41 %description -l pl.UTF-8
42 Oprogramowanie do zarządzania energią dla UPS-ów APC. Pozwala
43 komputerowi działać po awarii zasilania przez określony czas lub czas
44 życia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz
45 odpowiednio uruchamia kontrolowany shutdown przy dłuższej awarii
46 zasilania.
47
48 %package cgi 
49 Summary:        upsstats - Web-based UPS status viewer
50 Summary(pl.UTF-8):      upsstats - oparta na WWW przeglądarka stanu UPS-a
51 Group:          Applications/Networking
52 Requires:       webserver
53
54 %description cgi
55 upsstats.cgi builds a lightweight web page containing basic UPS status
56 information.
57
58 %description cgi -l pl.UTF-8
59 upsstats.cgi tworzy lekką stronę WWW zawierającą podstawowe informacje
60 o stanie UPS-a.
61
62 %prep
63 %setup -q
64 %patch0 -p1
65 for i in configure.in aclocal.m4 config.h.in; do install autoconf/$i .;done
66
67 %build
68 %{__autoconf}
69 %configure \
70         --with-log-dir=%{_var}/log \
71         --with-stat-dir=%{_var}/lib/apcupsd \
72 %if %{with cgi}
73         --enable-cgi \
74         --with-cgi-bin=/home/services/httpd/cgi-bin \
75 %endif
76         %{?with_test:--enable-test} \
77 %if %{with net}
78         --enable-net \
79         --enable-master-slave \
80 %endif
81         %{?with_snmp:--enable-snmp} \
82         %{?with_usb:--enable-usb}
83
84 %{__make}
85
86 %install
87 rm -rf $RPM_BUILD_ROOT
88 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d,sysconfig} \
89         $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
90
91 %{__make} install \
92         DESTDIR=$RPM_BUILD_ROOT
93         
94 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
95 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd
96 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/apcupsd
97
98 touch $RPM_BUILD_ROOT/var/log/apcupsd.events
99 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
100
101 cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF
102 #!/bin/sh
103 /etc/rc.d/init.d/apcupsd powerdown
104 EOF
105
106 %clean
107 rm -rf $RPM_BUILD_ROOT
108
109 %post
110 /sbin/chkconfig --add apcupsd
111 %service apcupsd restart "apcupsd daemon"
112
113 %preun
114 if [ "$1" = "0" ]; then
115         %service apcupsd stop
116         /sbin/chkconfig --del apcupsd
117 fi
118
119 %files
120 %defattr(644,root,root,755)
121 %doc ChangeLog Developers
122 %attr(755,root,root) %{_sbindir}/*
123 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apcupsd.conf
124 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/apcupsd
125 %attr(754,root,root) %{_sysconfdir}/apccontrol
126 %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/changeme
127 %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commfailure
128 %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/commok
129 #%attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mainsback
130 %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/masterconnect
131 %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mastertimeout
132 %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/onbattery
133 %attr(754,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/offbattery
134 %if %{with cgi}
135 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf
136 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/multimon.conf
137 %{_sysconfdir}/apcupsd.css
138 %endif
139 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
140 %attr(754,root,root) /etc/rc.d/init.d/halt
141 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/apcupsd
142 %dir %{_sysconfdir}
143 %dir /var/lib/apcupsd
144 %attr(640,root,root) %ghost /var/log/apcupsd.events
145 %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status
146 %{_mandir}/man8/apcupsd.*
147
148 %files cgi
149 %defattr(644,root,root,755)
150 %attr(755,root,root) %{_cgidir}/*.cgi
This page took 0.026934 seconds and 2 git commands to generate.