]>
Commit | Line | Data |
---|---|---|
1 | Summary: Power management software for APC UPS hardware | |
2 | Name: apcupsd | |
3 | Version: 3.8.1 | |
4 | Release: 3 | |
5 | License: GPL v2 | |
6 | Group: Networking/Daemons | |
7 | Group(de): Netzwerkwesen/Server | |
8 | Group(pl): Sieciowe/Serwery | |
9 | Source0: http://www.sibbald.com/apcupsd/download/%{name}-%{version}.tar.gz | |
10 | Patch0: %{name}-paths.patch | |
11 | Patch1: %{name}-pld.patch | |
12 | #Patch1: apcups-makefile.patch | |
13 | #Patch2: %{name}-Makefile-fix.patch | |
14 | URL: http://www.sibbald.com/apcupsd/ | |
15 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
16 | #Icon: apcupsd-logo.xpm | |
17 | ||
18 | %define _sysconfdir /etc/apcupsd | |
19 | ||
20 | %description | |
21 | UPS power management under Linux for APCC Products. It allows your | |
22 | computer/server to run during power problems for a specified length of | |
23 | time or the life of the batteries in your BackUPS, BackUPS Pro, | |
24 | SmartUPS v/s, or SmartUPS, and then properly executes a controlled | |
25 | shutdown during an extended power failure. | |
26 | ||
27 | %prep | |
28 | %setup -q | |
29 | %patch0 -p1 | |
30 | %patch1 -p1 | |
31 | #%patch2 -p0 | |
32 | ||
33 | %build | |
34 | %configure | |
35 | %{__make} | |
36 | ||
37 | %install | |
38 | rm -rf $RPM_BUILD_ROOT | |
39 | install -d $RPM_BUILD_ROOT{%{_sbindir},%{_bindir},%{_mandir}/man8,%{_sysconfdir},/etc/rc.d/init.d,/var/log,/var/lib/apcupsd} | |
40 | ||
41 | install apcupsd apcnetd $RPM_BUILD_ROOT%{_sbindir} | |
42 | install apcaccess $RPM_BUILD_ROOT%{_bindir} | |
43 | install etc/* $RPM_BUILD_ROOT%{_sysconfdir} | |
44 | install distributions/redhat/apccontrol.sh $RPM_BUILD_ROOT%{_sysconfdir}/apccontrol | |
45 | install distributions/redhat/apcupsd $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd | |
46 | install doc/apcupsd.man $RPM_BUILD_ROOT%{_mandir}/man8 | |
47 | tar czf doc.tar.gz doc | |
48 | ||
49 | touch ${RPM_BUILD_ROOT}/var/log/apcupsd.log | |
50 | touch ${RPM_BUILD_ROOT}/var/lib/apcupsd/apcupsd.status | |
51 | touch ${RPM_BUILD_ROOT}/var/lib/apcupsd/apcupsd.events | |
52 | ||
53 | %clean | |
54 | rm -rf ${RPM_BUILD_ROOT} | |
55 | ||
56 | %post | |
57 | /sbin/ldconfig | |
58 | /sbin/chkconfig --add apcupsd | |
59 | ||
60 | #if !(grep /sbin/powersc /etc/rc.d/init.d/halt > /dev/null); then | |
61 | cp -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.rpmorig | |
62 | #sed -e '/# Now halt or reboot./i\' \ | |
63 | # -e '\ | |
64 | # See if this is a powerfail situation.\ | |
65 | ||
66 | echo ' | |
67 | if [ -f /etc/apcupsd/powerfail ]; then\ | |
68 | echo "APCUPSD to the Rescue!"\ | |
69 | echo\ | |
70 | /etc/apcupsd/apccontrol killpower \ | |
71 | echo\ | |
72 | sleep 120\ | |
73 | exit 1\ | |
74 | fi\ | |
75 | ' > /etc/rc.d/init.d/halt | |
76 | #' /etc/rc.d/init.d/halt.rpmorig > /etc/rc.d/init.d/halt | |
77 | #fi | |
78 | ||
79 | ||
80 | %preun | |
81 | chkconfig --del apcupsd | |
82 | ||
83 | %files | |
84 | %defattr(644,root,root,755) | |
85 | %doc doc.tar.gz | |
86 | %doc ChangeLog | |
87 | %{_mandir}/man8/apcupsd.* | |
88 | %attr(755,root,root) %{_sbindir}/* | |
89 | %attr(755,root,root) %{_bindir}/* | |
90 | #%attr(755,root,root) %config /sbin/powersc | |
91 | %attr(640,root,root) %config(noreplace) %{_sysconfdir}/apcupsd.conf | |
92 | %attr(754,root,root) /etc/rc.d/init.d/apcupsd | |
93 | %ghost /var/log/apcupsd.log | |
94 | %ghost /var/lib/apcupsd/apcupsd.status | |
95 | %ghost /var/lib/apcupsd/apcupsd.events |