]> git.pld-linux.org Git - packages/apcupsd.git/blob - apcupsd.spec
- fixed trouble with compile.
[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 Patch2:         apcupsd-Makefile-fix.patch
10 Summary:        power management software for APC UPS hardware
11 URL:            http://www.brisse.dk/site/apcupsd/
12 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
13 #Icon:          apcupsd-logo.xpm
14
15 %description
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
20 extended power failure.
21
22 %prep
23 %setup -q -n %{name}-%{version}.src
24 %patch0 -p1
25 %patch1 -p1
26 %patch2 -p0
27
28 %build
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
35
36 %install
37 rm -rf ${RPM_BUILD_ROOT}
38
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
43 install -d ${RPM_BUILD_ROOT}/{sbin,bin,etc/rc.d/init.d,usr/man/man8,var/log}
44 NAME="-linux" make install
45 # hany: why this? we're just building. not installing
46 #[ -x /sbin/powersc ] && /sbin/powersc RESTARTME
47 gzip -9nf \b ${RPM_BUILD_ROOT}/usr/man/*/*.?
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
50 touch ${RPM_BUILD_ROOT}/var/log/apcupsd.log
51 touch ${RPM_BUILD_ROOT}/etc/apcupsd.status
52
53 %clean
54 rm -rf ${RPM_BUILD_ROOT}
55
56 %post
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 .
77
78 %preun
79 chkconfig --del apcups
80
81 %files
82 %defattr(644,root,root,755)
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
88 /usr/man/man8/apcupsd.8.gz
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
93 %attr(754, root, root) /etc/rc.d/init.d/apcups
94 %ghost /var/log/apcupsd.log
95 %ghost /etc/apcupsd.status
This page took 0.061752 seconds and 3 git commands to generate.