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