Author: glen                         Date: Mon Sep  4 15:03:52 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- use supervise to respawn process as it crashes without traces

---- Files affected:
SPECS:
   bopm.spec (1.20 -> 1.21) 

---- Diffs:

================================================================
Index: SPECS/bopm.spec
diff -u SPECS/bopm.spec:1.20 SPECS/bopm.spec:1.21
--- SPECS/bopm.spec:1.20        Mon Sep  4 16:45:51 2006
+++ SPECS/bopm.spec     Mon Sep  4 17:03:47 2006
@@ -2,6 +2,7 @@
 #
 # Conditional build:
 %bcond_without tests   # do not perform "make test"
+%bcond_without supervise       # install initscript instead of supervise
 #
 %include       /usr/lib/rpm/macros.perl
 %define                pnam    OPM
@@ -16,6 +17,8 @@
 # Source0-md5: ab1b7494c4242eef957b5fca61c92b18
 Source1:       %{name}.init
 Source2:       %{name}.conf
+Source3:       %{name}-supervise.tar.bz2
+# Source3-md5: 247c0438a5e2860097d09a374a521151
 Patch0:                %{name}-DESTDIR.patch
 Patch1:                %{name}-shared.patch
 Patch2:                %{name}-cr-connect.patch
@@ -36,11 +39,14 @@
 Requires(pre): /usr/sbin/groupadd
 Requires(pre): /usr/sbin/useradd
 Requires:      %{name}-libs = %{version}-%{release}
-Requires:      rc-scripts >= 0.4.0.17
+%{!?with_supervise:Requires:   rc-scripts >= 0.4.0.17}
+%{?with_supervise:Requires:    daemontools >= 0.76-5}
 Provides:      group(%{name})
 Provides:      user(%{name})
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define                _supervise      /etc/supervise/%{name}
+
 %description
 The Blitzed Open Proxy Monitor is designed to connect to an IRC server
 and become an IRC operator. It then watches connect notices in order
@@ -151,16 +157,31 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/var/{run,log}/%{name}}
+install -d $RPM_BUILD_ROOT/var/log/%{name}
 
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+%if %{with supervise}
+install -d $RPM_BUILD_ROOT%{_supervise}
+tar xf %{SOURCE3} -C $RPM_BUILD_ROOT%{_supervise}
+
+install -d $RPM_BUILD_ROOT%{_supervise}/{,log/}supervise
+touch $RPM_BUILD_ROOT%{_supervise}/{,log/}supervise/lock
+touch $RPM_BUILD_ROOT%{_supervise}/{,log/}supervise/status
+mkfifo $RPM_BUILD_ROOT%{_supervise}/{,log/}supervise/control
+mkfifo $RPM_BUILD_ROOT%{_supervise}/{,log/}supervise/ok
+
+%else
+install -D %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install -d $RPM_BUILD_ROOT/var/run/%{name}
+%endif
+
 install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
 > $RPM_BUILD_ROOT/var/log/%{name}/bopm.log
 > $RPM_BUILD_ROOT/var/log/%{name}/scan.log
 
+# Perl module
 cd src/libopm/OPM
 %{__make} pure_install \
        DESTDIR=$RPM_BUILD_ROOT
@@ -176,13 +197,27 @@
 %useradd -u 151 -c "BOPM Daemon" -g %{name} %{name}
 
 %post
+%if %{with supervise}
 /sbin/chkconfig --add %{name}
 %service %{name} restart "BOPM daemon"
+%else
+if [ -d /service/%{name}/supervise ]; then
+       svc -t /service/%{name} /service/%{name}/log
+fi
+%endif
 
 %preun
 if [ "$1" = "0" ]; then
+%if %{with supervise}
+       if [ -d /service/%{name}/supervise ]; then
+               cd /service/%{name}
+               rm /service/%{name}
+               svc -dx . log
+       fi
+%else
        %service %{name} stop
        /sbin/chkconfig --del %{name}
+%endif
 fi
 
 %postun
@@ -199,10 +234,23 @@
 %doc ChangeLog INSTALL README bopm.conf.sample
 %doc contrib/ network-bopm/
 %attr(640,root,bopm) %config(noreplace) %verify(not md5 mtime size) 
%{_sysconfdir}/%{name}.conf
-%attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(755,root,root) %{_sbindir}/%{name}
 
+%if %{with supervise}
+%attr(1755,root,root) %dir %{_supervise}
+%attr(755,root,root) %{_supervise}/run
+%attr(700,root,root) %dir %{_supervise}/supervise
+
+%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %ghost 
%{_supervise}/supervise/*
+%attr(1755,root,root) %dir %{_supervise}/log
+%attr(755,root,root) %{_supervise}/log/run
+%attr(700,root,root) %dir %{_supervise}/log/supervise
+%attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %ghost 
%{_supervise}/log/supervise/*
+%else
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(770,root,bopm) %dir /var/run/%{name}
+%endif
+
 %attr(770,root,bopm) %dir /var/log/%{name}
 %attr(640,bopm,bopm) %ghost /var/log/%{name}/bopm.log
 %attr(640,bopm,bopm) %ghost /var/log/%{name}/scan.log
@@ -238,6 +286,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.21  2006/09/04 15:03:47  glen
+- use supervise to respawn process as it crashes without traces
+
 Revision 1.20  2006/09/04 14:45:51  glen
 - add -c option patch from mailinglist
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/bopm.spec?r1=1.20&r2=1.21&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to