]>
Commit | Line | Data |
---|---|---|
82761b0b | 1 | Name: apcupsd |
2 | Version: 3.5.8 | |
3 | Release: 2 | |
4 | License: GPL v2 | |
6a96dc52 | 5 | Group: Networking/Daemons |
6 | Group(pl): Sieciowe/Serwery | |
7 | Source0: http://www.brisse.dk/site/apcupsd/download/%{name}-%{version}.src.tar.gz | |
82761b0b | 8 | Patch0: apcups-initscript.patch |
9 | Patch1: apcups-makefile.patch | |
f3fe0a16 | 10 | Patch2: apcupsd-Makefile-fix.patch |
82761b0b | 11 | Summary: power management software for APC UPS hardware |
12 | URL: http://www.brisse.dk/site/apcupsd/ | |
9860ec16 | 13 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
82761b0b | 14 | #Icon: apcupsd-logo.xpm |
03dfd68e | 15 | |
6a96dc52 | 16 | %define _prefix / |
17 | %define _mandir /usr/share/man | |
2534c785 | 18 | |
03dfd68e | 19 | %description |
82761b0b | 20 | UPS power management under Linux for APCC Products. It allows your |
6a96dc52 | 21 | computer/server to run during power problems for a specified length of |
22 | time or the life of the batteries in your BackUPS, BackUPS Pro, | |
23 | SmartUPS v/s, or SmartUPS, and then properly executes a controlled | |
24 | shutdown during an extended power failure. | |
03dfd68e | 25 | |
03dfd68e | 26 | %prep |
82761b0b | 27 | %setup -q -n %{name}-%{version}.src |
03dfd68e | 28 | %patch0 -p1 |
bb2476bb | 29 | %patch1 -p1 |
f3fe0a16 | 30 | %patch2 -p0 |
03dfd68e | 31 | |
32 | %build | |
bb2476bb | 33 | mv Makefile Makefile.orig |
34 | cat Makefile.orig \ | |
35 | | sed "s,^PREFIX =,PREFIX = ${RPM_BUILD_ROOT}," \ | |
36 | | sed "s,^MANPREFIX = /usr,MANPREFIX = ${RPM_BUILD_ROOT}/usr," \ | |
37 | > Makefile | |
6260da6b | 38 | %{__make} linux |
03dfd68e | 39 | |
40 | %install | |
6a96dc52 | 41 | rm -rf $RPM_BUILD_ROOT |
82761b0b | 42 | |
bb2476bb | 43 | # Some issues : |
44 | # - why doesn't the Makefile know that it should install *-linux ?? | |
45 | # - make install tries to stop apcupsd. That's not necessary (buildroot) (hany: not issue anymore) | |
46 | ||
2534c785 | 47 | #install -d ${RPM_BUILD_ROOT}/{sbin,bin,etc/rc.d/init.d,usr/man/man8,var/log} |
48 | install -d ${RPM_BUILD_ROOT}/{bin,sbin,usr/share/man/man8} | |
49 | install -d ${RPM_BUILD_ROOT}/{etc/rc.d/init.d,var/log} | |
50 | ||
6a96dc52 | 51 | NAME="-linux" make MANPREFIX="${RPM_BUILD_ROOT}%{_datadir}/" install |
bb2476bb | 52 | # hany: why this? we're just building. not installing |
53 | #[ -x /sbin/powersc ] && /sbin/powersc RESTARTME | |
6a96dc52 | 54 | gzip -9nf ${RPM_BUILD_ROOT}%{_mandir}/man8/* |
55 | install installs/apcupsd.conf ${RPM_BUILD_ROOT}%{_sysconfdir} | |
2534c785 | 56 | install installs/apcups.rhs ${RPM_BUILD_ROOT}/etc/rc.d/init.d/apcups |
03dfd68e | 57 | touch ${RPM_BUILD_ROOT}/var/log/apcupsd.log |
6a96dc52 | 58 | touch ${RPM_BUILD_ROOT}%{_sysconfdir}/apcupsd.status |
03dfd68e | 59 | |
03dfd68e | 60 | %clean |
61 | rm -rf ${RPM_BUILD_ROOT} | |
62 | ||
63 | %post | |
bb2476bb | 64 | /sbin/ldconfig |
65 | /sbin/chkconfig --add apcups | |
66 | if !(grep /sbin/powersc /etc/rc.d/init.d/halt > /dev/null); then | |
67 | cp -f /etc/rc.d/init.d/halt /etc/rc.d/init.d/halt.rpmorig | |
68 | sed -e '/# Now halt or reboot./i\' \ | |
69 | -e '\ | |
70 | # See if this is a powerfail situation.\ | |
71 | if [ -f /etc/powerfail ]; then\ | |
72 | echo "APCUPSD to the Rescue!"\ | |
73 | echo\ | |
74 | /sbin/powersc KILL\ | |
75 | echo\ | |
76 | sleep 120\ | |
77 | exit 1\ | |
78 | fi\ | |
79 | ' /etc/rc.d/init.d/halt.rpmorig > /etc/rc.d/init.d/halt | |
80 | ||
81 | fi | |
82 | echo Check the documentation to see whether /etc/rc.d/init.d/halt has a | |
83 | echo correct invocation of /sbin/powersc . | |
03dfd68e | 84 | |
85 | %preun | |
bb2476bb | 86 | chkconfig --del apcups |
03dfd68e | 87 | |
88 | %files | |
82761b0b | 89 | %defattr(644,root,root,755) |
2534c785 | 90 | %doc README.NEW Changelog port.gif Statement.APCC |
91 | %doc %{name}-%{version}.src.lsm | |
6a96dc52 | 92 | %doc readmes/* docs/apcupsd.docs |
2534c785 | 93 | %doc installs/halt.rhs installs/apcups.rhs installs/powersc |
6a96dc52 | 94 | %{_mandir}/man8/apcupsd.8* |
95 | %attr(755,root,root) /sbin/apcupsd | |
96 | %attr(755,root,root) /bin/apcaccess | |
97 | %attr(755,root,root) %config /sbin/powersc | |
98 | %attr(640,root,root) %config(noreplace) %{_sysconfdir}/apcupsd.conf | |
99 | %attr(754,root,root) /etc/rc.d/init.d/apcups | |
03dfd68e | 100 | %ghost /var/log/apcupsd.log |
6a96dc52 | 101 | %ghost %{_sysconfdir}/apcupsd.status |