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