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