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