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