]> git.pld-linux.org Git - packages/apcupsd.git/blob - apcupsd.spec
- simplified bcond, added %%verify(not md5 size mtime)
[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.16
10 Release:        1
11 License:        GPL v2
12 Group:          Networking/Daemons
13 Source0:        http://dl.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
14 # Source0-md5:  07de8f7d7488b6ef91f128f51713f4ea
15 Source1:        %{name}.init
16 Source2:        %{name}.logrotate
17 Source3:        %{name}.sysconfig
18 Patch0:         %{name}-configure.patch
19 URL:            http://www.apcupsd.com/
20 BuildRequires:  autoconf
21 BuildRequires:  automake
22 Requires(post,preun):   /sbin/chkconfig
23 Requires(post): fileutils
24 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
25
26 %define         _sysconfdir     /etc/apcupsd
27
28 %description
29 UPS power management under Linux for APCC Products. It allows your
30 computer/server to run during power problems for a specified length of
31 time or the life of the batteries in your BackUPS, BackUPS Pro,
32 SmartUPS v/s, or SmartUPS, and then properly executes a controlled
33 shutdown during an extended power failure.
34
35 %description -l pl
36 Oprogramowanie do zarz±dzania energi± dla UPS-ów APC. Pozwala
37 komputerowi dzia³aæ po awarii zasilania przez okre¶lony czas lub czas
38 ¿ycia akumulatorów w BackUPS, BackUPS Pro, SmartUPS v/s, SmartUPS oraz
39 odpowiednio uruchamia kontrolowany shutdown przy d³u¿szej awarii
40 zasilania.
41
42 %prep
43 %setup -q
44 %patch0 -p1
45
46 %build
47 cd autoconf
48 cp -f /usr/share/automake/config.sub .
49 %{__autoconf}
50 cp -f ./configure ..
51 cd ..
52 %configure \
53         --with-log-dir=%{_var}/log \
54         --with-stat-dir=%{_var}/lib/apcupsd \
55         %{?with_test:--enable-test} \
56 %if %{with usb}
57         --enable-usb \
58         --with-serial-dev=/dev/usb/hiddev[0-15] \
59         --with-upstype=usb \
60         --with-upscable=usb
61 %endif
62
63 %{__make}
64
65 %install
66 rm -rf $RPM_BUILD_ROOT
67 install -d $RPM_BUILD_ROOT/etc/{apcupsd,logrotate.d,rc.d/init.d,sysconfig} \
68         $RPM_BUILD_ROOT/var/{log,lib/apcupsd}
69
70 %{__make} install \
71         DESTDIR=$RPM_BUILD_ROOT
72
73 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/apcupsd
74 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apcupsd
75 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/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(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/sysconfig/apcupsd
111 %attr(754,root,root) %{_sysconfdir}/apccontrol
112 %attr(754,root,root) %{_sysconfdir}/changeme
113 %attr(754,root,root) %{_sysconfdir}/commfailure
114 %attr(754,root,root) %{_sysconfdir}/commok
115 %attr(754,root,root) %{_sysconfdir}/mainsback
116 %attr(754,root,root) %{_sysconfdir}/masterconnect
117 %attr(754,root,root) %{_sysconfdir}/mastertimeout
118 %attr(754,root,root) %{_sysconfdir}/onbattery
119 %attr(754,root,root) /etc/rc.d/init.d/apcupsd
120 %attr(754,root,root) /etc/rc.d/init.d/halt
121 %attr(640,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/logrotate.d/apcupsd
122 %dir /etc/apcupsd
123 %dir /var/lib/apcupsd
124 %attr(640,root,root) %ghost /var/log/apcupsd.events
125 %attr(640,root,root) %ghost /var/lib/apcupsd/apcupsd.status
This page took 0.039561 seconds and 3 git commands to generate.