]> git.pld-linux.org Git - packages/apcupsd.git/blob - apcupsd.spec
557dcacab4c58ca46f85ec2f44b1b2e7cc23d259
[packages/apcupsd.git] / apcupsd.spec
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:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
12 #Icon:          apcupsd-logo.xpm
13
14 %description
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
19 extended power failure.
20
21 %prep
22 %setup -q -n %{name}-%{version}.src
23 %patch0 -p1
24 %patch1 -p1
25
26 %build
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
33
34 %install
35 rm -rf ${RPM_BUILD_ROOT}
36
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
41 install -d ${RPM_BUILD_ROOT}/{sbin,bin,etc/rc.d/init.d,usr/man/man8,var/log}
42 NAME="-linux" make install
43 # hany: why this? we're just building. not installing
44 #[ -x /sbin/powersc ] && /sbin/powersc RESTARTME
45 gzip -9nf \b ${RPM_BUILD_ROOT}/usr/man/*/*.?
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
48 touch ${RPM_BUILD_ROOT}/var/log/apcupsd.log
49 touch ${RPM_BUILD_ROOT}/etc/apcupsd.status
50
51 %clean
52 rm -rf ${RPM_BUILD_ROOT}
53
54 %post
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 .
75
76 %preun
77 chkconfig --del apcups
78
79 %files
80 %defattr(644,root,root,755)
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
86 /usr/man/man8/apcupsd.8.gz
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(754, root, root) /etc/rc.d/init.d/apcups
92 %ghost /var/log/apcupsd.log
93 %ghost /etc/apcupsd.status
This page took 0.038573 seconds and 2 git commands to generate.