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