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