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