]> git.pld-linux.org Git - packages/apcupsd.git/blob - apcupsd.spec
- changes bcond, description, config
[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):    Oprogramowanie do zarz±dzania energi± dla UPS-ów APC
11 Name:           apcupsd
12 Version:        3.12.1
13 Release:        0.1
14 License:        GPL v2
15 Group:          Networking/Daemons
16 Source0:        http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
17 # Source0-md5:  d2e710176430a28d624500e145d9ffe3
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 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
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 Group:          Applications/Networking
51 Requires:       webserver
52
53 %description cgi
54 upsstats.cgi builds a lightweight web page containing basic status
55 information about a UPS
56
57 %prep
58 %setup -q
59 #%patch0 -p1
60
61 %build
62 cd autoconf
63 cp -f /usr/share/automake/config.sub .
64 %{__autoconf}
65 cp -f configure ..
66 cd ..
67
68 %configure \
69         --with-log-dir=%{_var}/log \
70         --with-stat-dir=%{_var}/lib/apcupsd \
71 %if %{with cgi}
72         --enable-cgi \
73         --with-cgi-bin=/home/services/httpd/cgi-bin \
74 %endif
75         %{?with_test:--enable-test} \
76 %if %{with net}
77         --enable-net \
78         --enable-master-slave \
79 %endif
80         %{?with_snmp:--enable-snmp} \
81         %{?with_usb:--enable-usb}
82
83 %{__make}
84
85 %install
86 rm -rf $RPM_BUILD_ROOT
87 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d,sysconfig} \
88         $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
89
90 %{__make} install \
91         DESTDIR=$RPM_BUILD_ROOT
92
93 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
94 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd
95 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/apcupsd
96
97 touch $RPM_BUILD_ROOT/var/log/apcupsd.events
98 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
99
100 cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF
101 #!/bin/sh
102 /etc/rc.d/init.d/apcupsd powerdown
103 EOF
104
105 %clean
106 rm -rf $RPM_BUILD_ROOT
107
108 %post
109 /sbin/chkconfig --add apcupsd
110 if [ -f /var/lock/subsys/apcupsd ]; then
111         /etc/rc.d/init.d/apcupsd restart >&2
112 else
113         echo "Run \"/etc/rc.d/init.d/apcupsd start\" to start apcupsd daemon."
114 fi
115
116 %preun
117 if [ "$1" = "0" ]; then
118         if [ -f /var/lock/subsys/apcupsd ]; then
119                 /etc/rc.d/init.d/apcupsd stop >&2
120         fi
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) %{_sysconfdir}/changeme
132 %attr(754,root,root) %{_sysconfdir}/commfailure
133 %attr(754,root,root) %{_sysconfdir}/commok
134 #%attr(754,root,root) %{_sysconfdir}/mainsback
135 %attr(754,root,root) %{_sysconfdir}/masterconnect
136 %attr(754,root,root) %{_sysconfdir}/mastertimeout
137 %attr(754,root,root) %{_sysconfdir}/onbattery
138 %attr(754,root,root) %{_sysconfdir}/offbattery
139 %if %{with cgi}
140 %attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/hosts.conf
141 %attr(644,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/multimon.conf
142 %attr(644,root,root) %{_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.03116 seconds and 3 git commands to generate.