]> git.pld-linux.org Git - packages/apcupsd.git/blob - apcupsd.spec
- bconded test support (enable by default)
[packages/apcupsd.git] / apcupsd.spec
1 #
2 # Conditional build:
3 %bcond_without  test    # without TEST support
4 %bcond_with     usb     # with USB support
5 #
6 Summary:        Power management software for APC UPS hardware
7 Summary(pl):    Oprogramowanie do zarz±dzania energi± dla UPS-ów APC
8 Name:           apcupsd
9 Version:        3.10.15
10 Release:        2
11 License:        GPL v2
12 Group:          Networking/Daemons
13 Source0:        http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
14 # Source0-md5:  21b2b744ebcaa0010367a403a9c5e66c
15 Source1:        %{name}.init
16 Source2:        %{name}.logrotate
17 Patch0:         %{name}-configure.patch
18 URL:            http://www.apcupsd.com/
19 BuildRequires:  autoconf
20 BuildRequires:  automake
21 Requires(post,preun):   /sbin/chkconfig
22 Requires(post): fileutils
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %define         _sysconfdir     /etc/apcupsd
26
27 %description
28 UPS power management under Linux for APCC Products. It allows your
29 computer/server to run during power problems for a specified length of
30 time or the life of the batteries in your BackUPS, BackUPS Pro,
31 SmartUPS v/s, or SmartUPS, and then properly executes a controlled
32 shutdown during an extended power failure.
33
34 %description -l pl
35 Oprogramowanie do zarz±dzania energi± dla UPS-ów APC. Pozwala
36 komputerowi dzia³aæ po awarii zasilania przez okre¶lony czas lub czas
37 ¿ycia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz
38 odpowiednio uruchamia kontrolowany shutdown przy d³u¿szej awarii
39 zasilania.
40
41 %prep
42 %setup -q
43 %patch0 -p1
44
45 %build
46 cd autoconf
47 cp -f /usr/share/automake/config.sub .
48 %{__autoconf}
49 cp -f ./configure ..
50 cd ..
51 %configure \
52         --with-log-dir=%{_var}/log \
53         --with-stat-dir=%{_var}/lib/apcupsd \
54 %if %{with test}
55         --enable-test \
56 %endif
57 %if %{with usb}
58         --enable-usb \
59         --with-serial-dev=/dev/usb/hiddev[0-15] \
60         --with-upstype=usb \
61         --with-upscable=usb
62 %endif
63
64 %{__make}
65
66 %install
67 rm -rf $RPM_BUILD_ROOT
68 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d} \
69         $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
70
71 %{__make} install \
72         DESTDIR=$RPM_BUILD_ROOT
73
74 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
75 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd
76
77 touch $RPM_BUILD_ROOT/var/log/apcupsd.events
78 touch $RPM_BUILD_ROOT/var/lib/apcupsd/apcupsd.status
79
80 cat > $RPM_BUILD_ROOT/etc/rc.d/init.d/halt << EOF
81 #!/bin/sh
82 /etc/rc.d/init.d/apcupsd powerdown
83 EOF
84
85 %clean
86 rm -rf $RPM_BUILD_ROOT
87
88 %post
89 /sbin/chkconfig --add apcupsd
90 if [ -f /var/lock/subsys/apcupsd ]; then
91         /etc/rc.d/init.d/apcupsd restart >&2
92 else
93         echo "Run \"/etc/rc.d/init.d/apcupsd start\" to start apcupsd daemon."
94 fi
95
96 %preun
97 if [ "$1" = "0" ]; then
98         if [ -f /var/lock/subsys/apcupsd ]; then
99                 /etc/rc.d/init.d/apcupsd stop >&2
100         fi
101 /sbin/chkconfig --del apcupsd
102 fi
103
104 %files
105 %defattr(644,root,root,755)
106 %doc ChangeLog Developers doc/{README.apcaccess,README.solaris}
107 %{_mandir}/man8/apcupsd.*
108 %attr(755,root,root) %{_sbindir}/*
109 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/apcupsd.conf
110 %attr(754,root,root) %{_sysconfdir}/apccontrol
111 %attr(754,root,root) %{_sysconfdir}/changeme
112 %attr(754,root,root) %{_sysconfdir}/commfailure
113 %attr(754,root,root) %{_sysconfdir}/commok
114 %attr(754,root,root) %{_sysconfdir}/mainsback
115 %attr(754,root,root) %{_sysconfdir}/masterconnect
116 %attr(754,root,root) %{_sysconfdir}/mastertimeout
117 %attr(754,root,root) %{_sysconfdir}/onbattery
118 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
119 %attr(754,root,root) /etc/rc.d/init.d/halt
120 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/logrotate.d/apcupsd
121 %dir /etc/apcupsd
122 %dir /var/lib/apcupsd
123 %attr(640,root,root) %ghost /var/log/apcupsd.events
124 %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status
This page took 0.086904 seconds and 4 git commands to generate.