[packages/runit] - main package with service supervision tools (init stuff moved to subpackage) - runsvdir initscript

mis mis at pld-linux.org
Thu Jun 1 10:59:51 CEST 2017


commit b950a5735af353415dc91381b27d92c719d8c75d
Author: mis <mistoo at gmail.com>
Date:   Thu Jun 1 10:58:22 2017 +0200

    - main package with service supervision tools (init stuff moved to subpackage)
    - runsvdir initscript
    - up to 2.1.2

 runit.spec    | 72 +++++++++++++++++++++++++++------------------------
 runsvdir.init | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 34 deletions(-)
---
diff --git a/runit.spec b/runit.spec
index fc6aa31..3ce762e 100644
--- a/runit.spec
+++ b/runit.spec
@@ -1,18 +1,14 @@
 Summary:	A UNIX init scheme with service supervision
 Summary(pl.UTF-8):	Implementacja uniksowego inita z dozorem usług
 Name:		runit
-Version:	2.1.1
-Release:	0.1
+Version:	2.1.2
+Release:	1
 License:	BSD style
 Group:		Daemons
 Source0:	http://smarden.org/runit/%{name}-%{version}.tar.gz
-# Source0-md5:	8fa53ea8f71d88da9503f62793336bc3
+# Source0-md5:	6c985fbfe3a34608eb3c53dc719172c4
 Patch0:		%{name}-nostatic.patch
-# Are Source[1-4] needed?
-Source1:	http://fisheye1.cenqua.com/browse/~raw,r=1.1/smeserver/runit/S/%{name}.svup
-Source2:	http://fisheye1.cenqua.com/browse/~raw,r=1.1/smeserver/runit/S/%{name}.svdown
-Source3:	http://fisheye1.cenqua.com/browse/~raw,r=1.1/smeserver/runit/S/%{name}.svdepcalc
-Source4:	http://fisheye1.cenqua.com/browse/~raw,r=1.1/smeserver/runit/S/%{name}.dependencies.README
+Source1:	runsvdir.init
 Source10:	%{name}-stage-1
 URL:		http://smarden.org/runit/
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -24,36 +20,31 @@ runit is a daemontools alike replacement for SysVinit and other init
 schemes. runit runs on GNU/Linux, OpenBSD, FreeBSD, and can easily be
 adapted to other Unix operating systems.
 
-Warning: Replacing SysVinit or init can cause the system's boot to
-fail. Make sure you are able to recover and repair your system, for
-example if you run a boot loader, it should be able to pass
-init=/bin/sh to the kernel.
+This package contains service supervision tools. 
 
 %description -l pl.UTF-8
 runit to podobny do daemontools zamiennik demona SysVinit i innych
 rodzajów procesu init. Działa na systemach GNU/Linux, OpenBSD i
 FreeBSD, może być łatwo zaadaptowany do innych systemów uniksowych.
 
-Uwaga: podmiana pakietu SysVinit lub innego inita może spowodować, że
-system nie będzie mógł się uruchomić. Należy się upewnić, że jest
-możliwość odtworzenia i naprawy systemu, na przykład z poziomu
-bootloadera przez przekazanie do jądra init=/bin/sh.
-
-%package scripts
-Summary:	Scripts for runit
+%package init
+Summary:	runit as init
 Group:		Base
 Requires:	%{name} = %{version}-%{release}
 
-%description scripts
-Scripts for runit.
+%description init
+runit as init
 
 %prep
 %setup -qc
 mv admin/%{name}-%{version}/* .
 %patch0 -p1
-cp -a %{SOURCE4} doc/dependencies.README
 rm -f doc/debian
 
+# dirty patch
+perl -pi -e 's|varservice\s*=\s*\"/service\/"\s*;|varservice = "/etc/runit/service"; /* pld_linux_patch_mark */|' src/sv.c
+grep -q 'pld_linux_patch_mark' src/sv.c    # check if applied
+
 %build
 echo '%{__cc} %{rpmldflags}' > src/conf-ld
 echo '%{__cc} %{rpmcflags} -Wall' > src/conf-cc
@@ -61,17 +52,15 @@ echo '%{__cc} %{rpmcflags} -Wall' > src/conf-cc
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_sbindir}
+install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man8,/etc/{rc.d/init.d,sysconfig}} \
+        $RPM_BUILD_ROOT%{_sysconfdir}/runit/service \
+        $RPM_BUILD_ROOT%{_sysconfdir}/runit/sv
+
 for i in $(cat package/commands); do
 	install command/$i $RPM_BUILD_ROOT%{_sbindir}
 done
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/svisup
-install %{SOURCE2} $RPM_BUILD_ROOT%{_sbindir}/svisdown
-install %{SOURCE3} $RPM_BUILD_ROOT%{_sbindir}/svdepcalc
-install -d $RPM_BUILD_ROOT%{_mandir}/man8
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/runsvdir
 install man/*.8 $RPM_BUILD_ROOT%{_mandir}/man8
-
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/runit
 install %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/runit/1
 
 %clean
@@ -79,11 +68,26 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc doc/*
-%attr(755,root,root) %{_sbindir}/*
-%{_mandir}/man8/*
+%attr(754,root,root) /etc/rc.d/init.d/runsvdir
+%attr(755,root,root) %{_sbindir}/chpst
+%attr(755,root,root) %{_sbindir}/runsv
+%attr(755,root,root) %{_sbindir}/runsvchdir
+%attr(755,root,root) %{_sbindir}/runsvdir
+%attr(755,root,root) %{_sbindir}/sv
+%attr(755,root,root) %{_sbindir}/svlogd
+%attr(755,root,root) %{_sbindir}/utmpset
+%dir %{_sysconfdir}/runit
+%dir %{_sysconfdir}/runit/service
+%dir %{_sysconfdir}/runit/sv
+%{_mandir}/man8/chpst*
+%{_mandir}/man8/runsv*
+%{_mandir}/man8/sv*
+%{_mandir}/man8/utmpset*
 
-%files scripts
+%files init
 %defattr(644,root,root,755)
-%dir %{_sysconfdir}/runit
+%attr(755,root,root) %{_sbindir}/runit
+%attr(755,root,root) %{_sbindir}/runit-init
 %{_sysconfdir}/runit/1
+%{_mandir}/man8/runit*
+%doc doc/*
diff --git a/runsvdir.init b/runsvdir.init
new file mode 100755
index 0000000..052d1b6
--- /dev/null
+++ b/runsvdir.init
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# RUnit's runsvdir
+#
+# chkconfig:	345 20 80
+#
+# processname:	runsvdir
+# pidfile: /var/run/runsvdir.pid
+#
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/runsvdir ] && . /etc/sysconfig/runsvdir
+OPTIONS="-P /etc/runit/service 'log: ...................................................................................................................................................................................................................................................................................................................................................'"
+
+pidfile="/var/run/runsvdir.pid"
+
+start() {
+	if status --pidfile $pidfile runsvdir runsvdir >/dev/null; then
+		msg_already_running "runsvdir"
+		RETVAL=1
+		return
+	fi
+                
+	msg_starting "runsvdir"
+	daemon --fork --makepid --pidfile $pidfile --waitforname runsvdir /sbin/runsvdir $OPTIONS 
+	touch /var/lock/subsys/runsvdir
+	RETVAL=0
+}
+
+stop() {
+        if status --pidfile $pidfile runsvdir runsvdir >/dev/null; then
+            msg_stopping "runsvdir"
+	    busy
+            killproc --pidfile $pidfile runsvdir
+        else
+	    msg_not_running "runsvdir"
+	fi
+	rm -f /var/lock/subsys/runsvdir
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/runsvdir ]; then
+		msg_not_running "runsvdir"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status --pidfile $pidfile runsvdir runsvdir
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/runit.git/commitdiff/b950a5735af353415dc91381b27d92c719d8c75d



More information about the pld-cvs-commit mailing list