Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > media > contrib-src > by-pkgid > c7a86cf0eb62bda2548e746df777fe5d > files > 3

smartupstools-0.41.2-5mdk.src.rpm

%define name smartupstools
%define version 0.41.2
%define release 5mdk

Summary: Smart-UPS Tools
Name: %{name}
Version: %{version}
Release: %{release}
Source: %{name}-%{version}.tar.bz2
Source1: upsd.conf
Source2: ups
Source3: ups.logrotate
URL: http://www.exploits.org/~rkroll/smartupstools/
Patch: smartupstools-upsconfig.patch.bz2
License: GPL
Group: Monitoring
Requires: initscripts >= 2.91, gd >= 1.3
BuildRoot: %{_tmppath}/%{name}-buildroot

%description
The programs contained in this package allow multiple systems to monitor one
or more Unitteruptable Power Supplies (UPS) and shut down when conditions
warrant.  There are CGI programs included that will display data from systems
through your web browser, too.
The interface resembles Powerchute - other looks can be created easily by
linking to a module that handles the network communications for you.  Finally,
the source has been released under the GNU General Public License.

Current Models include: 
smartups         - APC Smart-UPS models (also Matrix-UPS)
backupspro       - APC Back-UPS Pro models
backups          - APC Back-UPS models
ups-trust425+625 - Trust (KingPro) 425/625

upsfetch.o and upsfetch.h can be used to program other applications to be UPS 
clients that can communicate with the UPS.

%prep
rm -fr $RPM_BUILD_ROOT

%setup -n %{name}-0.41.2
%patch -p0 -b .upsconfig

%build
%make CFLAGS="$RPM_OPT_FLAGS"
%make cgi CFLAGS="$RPM_OPT_FLAGS"
%make CFLAGS="$RPM_OPT_FLAGS"

%install
mkdir -p  $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/{init.d,rc0.d,rc1.d,rc2.d,rc3.d,rc4.d,rc5.d,rc6.d}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/{sysconfig,logrotate.d}
mkdir -p $RPM_BUILD_ROOT/var/state/ups
BASEPATH=$RPM_BUILD_ROOT/usr/local/ups prefix=$RPM_BUILD_ROOT/usr/local/ups make -e install install-cgi install-misc
install -m 644 $RPM_SOURCE_DIR/ups.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/ups
install -m 644 $RPM_SOURCE_DIR/upsd.conf $RPM_BUILD_ROOT/usr/local/ups/etc
install -m 755 $RPM_SOURCE_DIR/ups $RPM_BUILD_ROOT/etc/rc.d/init.d
install -m 644 $RPM_BUILD_DIR/%{name}-0.41.2/scripts/RedHat-6.0/ups-config $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
cd $RPM_BUILD_ROOT%{_sysconfdir}/rc.d
ln -s ../init.d/ups rc0.d/K05ups
ln -s ../init.d/ups rc1.d/S05ups
ln -s ../init.d/ups rc2.d/S05ups
ln -s ../init.d/ups rc3.d/S05ups
ln -s ../init.d/ups rc4.d/S05ups
ln -s ../init.d/ups rc5.d/S05ups
ln -s ../init.d/ups rc6.d/K05ups

if ! grep '^localhost$' $RPM_BUILD_ROOT/usr/local/ups/etc/hosts.conf > /dev/null; then
	echo "MONITOR localhost \"localhost\"" >> $RPM_BUILD_ROOT/usr/local/ups/etc/hosts.conf
fi

%post
echo
echo "---------NOTICE------------"
echo "You will need to edit the second line begining with UPS in"
echo "/usr/local/ups/etc/upsd.conf before using this"
echo "software. You should also look at the other configuration"
echo "files in that directory."
echo
echo "You also need to modify /etc/sysconfig/ups-config."
echo "By default it runs smartups on ttyS1. This"
echo "can be changed to backups, backupspro, or  ups-trust425+625,"
echo "and any appropriate device."
echo
echo "Finally, you may need to 'chmod a+rw' the device file"
echo "so that upsd can open it properly. This is very unsafe, but I"
echo "have yet to find a better way."


%clean
test "$RPM_BUILD_ROOT" != "/" && rm -fr $RPM_BUILD_ROOT

%files
%defattr (-,root,root)
%doc COPYING Changes Changes.trust QUICKSTART README docs/access.txt docs/new-modules.txt docs/protocol.txt docs/todo.txt docs/commands.txt docs/pager.txt docs/tips.txt docs/ups-trust425+625.txt docs/FAQ
%config /etc/rc.d/init.d/ups
%config /etc/sysconfig/ups-config
%config /etc/logrotate.d/ups 
%config /etc/rc.d/rc0.d/K05ups
%config /etc/rc.d/rc1.d/S05ups
%config /etc/rc.d/rc2.d/S05ups
%config /etc/rc.d/rc3.d/S05ups
%config /etc/rc.d/rc5.d/S05ups
%config /etc/rc.d/rc6.d/K05ups
#/usr/local/ups/cgi-bin/multimon.cgi
#/usr/local/ups/cgi-bin/upsimage.cgi
#/usr/local/ups/cgi-bin/upsstats.cgi
/usr/local/ups/misc/upsfetch.o
/usr/local/ups/misc/upsfetch.h
/usr/local/ups/bin/*
/usr/local/ups/etc/hosts.conf
/usr/local/ups/etc/upsmon.conf
/usr/local/ups/etc/upsd.conf
/usr/local/ups/etc/multimon.conf
%dir /var/state/ups

%changelog
* Tue Sep 04 2001  Lenny Cartier <lenny@mandrakesoft.com> 0.41.2-5mdk
- rebuild

* Mon Jan 29 2001 Lenny Cartier <lenny@mandrakesoft.com> 0.41.2-4mdk
- rebuild

* Mon Sep 18 2000 Lenny Cartier <lenny@mandrakesoft.com> 0.41.2-3mdk
- BM

* Wed May 03 2000 Lenny Cartier <lenny@mandrakesoft.com> 0.41.2-2mdk
- fix group
- bzip2 patch

* Wed Sep 15 1999 Thierry Vignaud <tvignaud@mandrakesoft.com>
- pre9 version
- include work from Sean P. Kane <kane@ca.metsci.com> :
   - Added support for upslog and logrotate.d
   - Fixed permissions on /var/state/ups

* Mon Aug 23 1999 Thierry Vignaud <tvignaud@mandrakesoft.com>

- fix spec