Sophie

Sophie

distrib > Mandriva > 10.2 > i586 > by-pkgid > 4e2de79c040c35eaa81a90455cd279c4 > files > 4

watchcatd-1.1-1mdk.src.rpm

%define name	watchcatd
%define version	1.1
%define release	1mdk

Summary:	Software watchdog, but less drastic than the usual solutions
Name:		%{name}
Version:	%{version}
Release:	%{release}
License:	GPL
Group:		System/Servers
URL:		http://oss.digirati.com.br/watchcatd/
Source0:	http://oss.digirati.com.br/watchcatd/%{name}-%{version}.tar.bz2
Source1:	watchcatd.init.bz2
Source2:	watchcatd.sysconfig.bz2
Patch0:		watchcatd-1.1-pid.diff.bz2
PreReq:		rpm-helper
BuildRequires:	libevent-devel
BuildRequires:	libwcat-devel
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot

%description
watchcatd is a software service that monitors processes. A bug or
malicious attacks to machine can lock up a process, leading to a
deadlock or an unexpected condition. If a monitored process locks
up, it is killed. 

On an alternate setup, watchcatd can be configured to work as a
timer.

%prep

%setup -q
%patch0 -p1

bzcat %{SOURCE1} > watchcatd.init
bzcat %{SOURCE2} > watchcatd.sysconfig

mv tester/cattester.c .
rm -f tester/Makefile

# lib64 fixes
perl -pi -e "s|/usr/lib|%{_libdir}|g" *

%build

%make CFLAGS="%{optflags}"

gcc %{optflags} -c cattester.c
gcc %{optflags} -o cattester cattester.o -lwcat

%install
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}

# don't fiddle with the initscript!
export DONT_GPRINTIFY=1

install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_initrddir}
install -d %{buildroot}%{_sysconfdir}/sysconfig
install -d %{buildroot}%{_libdir}/watchcatd
install -d %{buildroot}%{_localstatedir}/watchcat
install -d %{buildroot}%{_mandir}/man{5,8}
install -d %{buildroot}%{_var}/run/watchcatd

install -m0755 catmaster %{buildroot}%{_libdir}/watchcatd
install -m0755 catslave %{buildroot}%{_libdir}/watchcatd
install -m0755 wcatstat %{buildroot}%{_sbindir}/
install -m0755 cattester %{buildroot}%{_sbindir}/

install -m0755 watchcatd.init %{buildroot}%{_initrddir}/watchcatd
install -m0644 watchcatd.prod.conf %{buildroot}%{_sysconfdir}/watchcatd.conf
install -m0644 watchcatd.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/watchcatd
install -m0644 watchcatd.8 %{buildroot}%{_mandir}/man8/
install -m0644 watchcatd.conf.5 %{buildroot}%{_mandir}/man5/

%pre
%_pre_useradd watchcat %{_localstatedir}/watchcat /bin/false

%post
%_post_service watchcatd

%preun
%_preun_service watchcatd

%postun
%_postun_userdel watchcat

%clean
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc ChangeLog TODO tester
%attr(0755,root,root) %config(noreplace) %{_initrddir}/watchcatd
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/watchcatd.conf
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/watchcatd
%attr(0755,root,root) %{_sbindir}/cattester
%attr(0755,root,root) %{_libdir}/watchcatd/catmaster
%attr(0755,root,root) %{_libdir}/watchcatd/catslave
%attr(0755,root,root) %{_sbindir}/wcatstat
%{_mandir}/man8/*
%{_mandir}/man5/*
%dir %attr(0755,watchcat,watchcat) %{_localstatedir}/watchcat
%dir %attr(0755,watchcat,watchcat) %{_var}/run/watchcatd

%changelog
* Tue Jan 04 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 1.1-1mdk
- initial mandrake package, used parts of the provided spec file
- added S1,S2 and P0