1eb450c
Name:         apcupsd
77bf9ec
Version:      3.14.0
591cc69
Release:      2%{?dist}
1eb450c
Summary:      APC UPS Power Control Daemon for Linux
1eb450c
1eb450c
Group:        System Environment/Daemons
1eb450c
License:      GPL
1eb450c
URL:          http://www.apcupsd.com
1eb450c
Source0:      http://download.sourceforge.net/apcupsd/%{name}-%{version}.tar.gz
390086c
Source1:      apcupsd.logrotate
390086c
Source2:      apcupsd-httpd.conf
1eb450c
Patch0:       apcupsd-3.10.18-init.patch
1eb450c
BuildRoot:    %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
1eb450c
77bf9ec
BuildRequires: glibc-devel >= 2.3, gd-devel > 2.0
24d0ccf
BuildRequires: net-snmp-devel, gettext-devel, ncurses-devel, tcp_wrappers
77bf9ec
BuildRequires: gtk2-devel, gnome-vfs2-devel, desktop-file-utils
1eb450c
Requires:      /bin/mail
1eb450c
Requires(post):  /sbin/chkconfig
1eb450c
Requires(preun): /sbin/chkconfig
1eb450c
1eb450c
%description
1eb450c
Apcupsd can be used for controlling most APC UPSes. During a
1eb450c
power failure, apcupsd will inform the users about the power
1eb450c
failure and that a shutdown may occur.  If power is not restored,
1eb450c
a system shutdown will follow when the battery is exausted, a
1eb450c
timeout (seconds) expires, or the battery runtime expires based
1eb450c
on internal APC calculations determined by power consumption
1eb450c
rates.  If the power is restored before one of the above shutdown
1eb450c
conditions is met, apcupsd will inform users about this fact.
1eb450c
Some features depend on what UPS model you have (simple or smart).
1eb450c
1eb450c
1eb450c
%package cgi
1eb450c
Summary:      Web interface for apcupsd
1eb450c
Group:        Applications/Internet
1eb450c
Requires:     %{name} = %{version}-%{release}
1eb450c
Requires:     httpd
1eb450c
1eb450c
%description cgi
1eb450c
A CGI interface to the APC UPS monitoring daemon.
1eb450c
1eb450c
77bf9ec
%package gui
77bf9ec
Summary:      GUI interface for apcupsd
77bf9ec
Group:        Applications/System
77bf9ec
Requires:     %{name} = %{version}-%{release}
77bf9ec
77bf9ec
%description gui
77bf9ec
A GUI interface to the APC UPS monitoring daemon.
77bf9ec
77bf9ec
1eb450c
%prep
1eb450c
%setup -q
1eb450c
%patch -p1 -b .init
d285013
# Don't strip binaries
d285013
sed -i -e 's/^\(.*INSTALL_PROGRAM.*\) -s /\1 /' src{,/cgi}/Makefile.in
1eb450c
77bf9ec
1eb450c
%build
1eb450c
%configure \
1eb450c
        --sysconfdir="%{_sysconfdir}/apcupsd" \
390086c
        --with-cgi-bin="%{_localstatedir}/www/apcupsd" \
1eb450c
        --enable-cgi \
1eb450c
        --enable-pthreads \
1eb450c
        --enable-net \
1eb450c
        --enable-apcsmart \
1eb450c
        --enable-dumb \
390086c
        --enable-net-snmp \
390086c
        --enable-snmp \
1eb450c
        --enable-usb \
390086c
        --enable-powerflute \
390086c
        --enable-nls \
77bf9ec
        --enable-gapcmon \
77bf9ec
        --enable-pcnet \
390086c
        --with-libwrap=%{_libdir} \
1eb450c
        --with-serial-dev= \
1eb450c
        --with-upstype=usb \
1eb450c
        --with-upscable=usb \
1eb450c
        APCUPSD_MAIL=/bin/mail
1eb450c
make
1eb450c
1eb450c
1eb450c
%install
1eb450c
rm -rf $RPM_BUILD_ROOT
1eb450c
1eb450c
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
390086c
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/www/apcupsd
1eb450c
1eb450c
make DESTDIR=$RPM_BUILD_ROOT install
1eb450c
1eb450c
rm $RPM_BUILD_ROOT%{_initrddir}/halt
1eb450c
rm $RPM_BUILD_ROOT%{_initrddir}/halt.old
1eb450c
1eb450c
install -m744 platforms/apccontrol \
1eb450c
              $RPM_BUILD_ROOT%{_sysconfdir}/apcupsd/apccontrol
1eb450c
	      
1eb450c
install -m755 platforms/redhat/apcupsd $RPM_BUILD_ROOT%{_initrddir}
1eb450c
390086c
install -d %{buildroot}%{_sysconfdir}/logrotate.d
390086c
install -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
390086c
install -d %{buildroot}%{_sysconfdir}/httpd/conf.d
390086c
install -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
390086c
77bf9ec
desktop-file-install --vendor="fedora" \
77bf9ec
        --dir=${RPM_BUILD_ROOT}%{_datadir}/applications \
77bf9ec
        --delete-original \
77bf9ec
        ${RPM_BUILD_ROOT}%{_datadir}/applications/gapcmon.desktop
77bf9ec
77bf9ec
# Cleanup for later %doc processing
1769f57
chmod -x examples/*.conf examples/*.c
1eb450c
rm examples/*.in
1eb450c
1eb450c
1eb450c
%clean
1eb450c
rm -rf $RPM_BUILD_ROOT
1eb450c
1eb450c
1eb450c
%files
1eb450c
%defattr(-,root,root,-)
1769f57
%doc COPYING ChangeLog examples ReleaseNotes
1eb450c
%dir %{_sysconfdir}/apcupsd
1eb450c
%{_initrddir}/apcupsd
1eb450c
%config(noreplace) %{_sysconfdir}/apcupsd/apcupsd.conf
1eb450c
%config(noreplace) %{_sysconfdir}/apcupsd/hosts.conf
1eb450c
%config(noreplace) %{_sysconfdir}/apcupsd/multimon.conf
1eb450c
%attr(0755,root,root) %{_sysconfdir}/apcupsd/apccontrol
ea481f0
%config(noreplace) %{_sysconfdir}/apcupsd/changeme
ea481f0
%config(noreplace) %{_sysconfdir}/apcupsd/commfailure
ea481f0
%config(noreplace) %{_sysconfdir}/apcupsd/commok
ea481f0
%config(noreplace) %{_sysconfdir}/apcupsd/offbattery
ea481f0
%config(noreplace) %{_sysconfdir}/apcupsd/onbattery
390086c
%config(noreplace) %{_sysconfdir}/logrotate.d/apcupsd
1eb450c
%attr(0755,root,root) %{_sbindir}/*
1eb450c
%{_mandir}/*/*
1eb450c
1eb450c
%files cgi
1eb450c
%defattr(-,root,root,-)
1eb450c
%config(noreplace) %{_sysconfdir}/apcupsd/apcupsd.css
390086c
%config(noreplace) %{_sysconfdir}/httpd/conf.d/apcupsd.conf
390086c
%{_localstatedir}/www/apcupsd/
1eb450c
77bf9ec
%files gui
77bf9ec
%defattr(-,root,root,-)
77bf9ec
%{_bindir}/gapcmon
77bf9ec
%{_datadir}/applications/fedora-gapcmon.desktop
77bf9ec
%{_datadir}/pixmaps/apcupsd.png
77bf9ec
%{_datadir}/pixmaps/charging.png
77bf9ec
%{_datadir}/pixmaps/gapc_prefs.png
77bf9ec
%{_datadir}/pixmaps/onbatt.png
77bf9ec
%{_datadir}/pixmaps/online.png
77bf9ec
%{_datadir}/pixmaps/unplugged.png
77bf9ec
1eb450c
1eb450c
%post
1eb450c
# add our links
1eb450c
if [ "$1" -ge 1 ] ; then
1eb450c
/sbin/chkconfig --add apcupsd
1eb450c
fi
1eb450c
1eb450c
1eb450c
%preun
1eb450c
if [ $1 = 0 ] ; then
1eb450c
        # remove startup links
1eb450c
        /sbin/chkconfig --del apcupsd
1eb450c
fi
1eb450c
1eb450c
1eb450c
%changelog
591cc69
* Fri Apr 19 2007 - Orion Poplawski <orion@cora.nwra.com> - 3.14.0-2
591cc69
- Rebuild with RHEL5 final
591cc69
24d0ccf
* Fri Mar 23 2007 - Orion Poplawski <orion@cora.nwra.com> - 3.14.0-1
77bf9ec
- Update to 3.14.0
24d0ccf
- No tcp_wrappers-devel in EL
77bf9ec
77bf9ec
* Fri Jan  5 2007 - Orion Poplawski <orion@cora.nwra.com> - 3.13.9-2
77bf9ec
- Mark everything in /etc/apcupsd noreplace
77bf9ec
- Change BR to tcp_wrappers-devel
77bf9ec
77bf9ec
* Thu Nov 30 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.13.9-1
77bf9ec
- Update to 3.13.9, add gui package
ea481f0
29cc871
* Mon Oct  9 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.12.4-3
29cc871
- Fix /etc/httpd/conf.d/apcupsd.conf so DirectoryIndex works (bug #209952).
29cc871
  Patch from Clive Messer (clive@vacuumtube.org.uk)
29cc871
4212905
* Tue Aug 29 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.12.4-2
4212905
- Rebuild for FC6
4212905
a6ddb1b
* Mon Aug 21 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.12.4-1
a6ddb1b
- Update to 3.12.4
a6ddb1b
d285013
* Tue Jan 10 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.12.2-1
d285013
- Update to 3.12.2
d285013
- Don't strip binaries
d285013
70c71f8
* Tue Jan 10 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.12.1-1
70c71f8
- Update to 3.12.1
70c71f8
1769f57
* Wed Jan  4 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.12.0-1
1769f57
- Update to 3.12.0
1769f57
0b3ed40
* Tue Jan  3 2006 - Orion Poplawski <orion@cora.nwra.com> - 3.10.18-7
0b3ed40
- Rebuild
0b3ed40
eb89ad7
* Wed Dec 21 2005 - Orion Poplawski <orion@cora.nwra.com> - 3.10.18-6
eb89ad7
- Rebuild
eb89ad7
61de78e
* Wed Nov 16 2005 - Orion Poplawski <orion@cora.nwra.com> - 3.10.18-5
61de78e
- Bump for new openssl
61de78e
390086c
* Fri Nov  4 2005 - Orion Poplawski <orion@cora.nwra.com> - 3.10.18-4
390086c
- Add logrotate script for /var/log/apcupsd.events
390086c
- Add apache configuration script and change cgi directory to
390086c
  /var/www/apcupsd
390086c
- Compile in snmp, net-snmp, powerflute, nls, add tcp_wrappers support
390086c
1eb450c
* Mon Oct 17 2005 - Orion Poplawski <orion@cora.nwra.com> - 3.10.18-3
77bf9ec
- Removed %%{_smp_mflags} from make, broke builds
1eb450c
- Patch init file to not start automatically and add reload
1eb450c
- Mark css file config
1eb450c
- Require /sbin/chkconfig
1eb450c
1eb450c
* Mon Oct 17 2005 - Orion Poplawski <orion@cora.nwra.com> - 3.10.18-2
77bf9ec
- Add %%defattr to -cgi package
1eb450c
1eb450c
* Wed Aug 17 2005 - Orion Poplawski <orion@cora.nwra.com> - 3.10.18-1
1eb450c
- Initial Fedora Version