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