public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:master commit in: etc/, sh/
@ 2015-05-11 14:50 William Hubbs
  0 siblings, 0 replies; only message in thread
From: William Hubbs @ 2015-05-11 14:50 UTC (permalink / raw
  To: gentoo-commits

commit:     a15fa1a3b12a5372c1b3c8d5df7e489648bef913
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat May  9 22:56:45 2015 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon May 11 14:44:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a15fa1a3

Rework supervisor integration framework

The original way of doing this allowed users to change the supervisor in
conf.d/*. This changes this so that the supervisor setup can be done in
the service script itself.

 etc/rc.conf.in          |  6 ------
 sh/openrc-run.sh.in     | 44 +++++++++++++++++++++++++++++++++++++-------
 sh/start-stop-daemon.sh |  8 ++++----
 3 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/etc/rc.conf.in b/etc/rc.conf.in
index 7fcdfe8..69a5cf2 100644
--- a/etc/rc.conf.in
+++ b/etc/rc.conf.in
@@ -111,12 +111,6 @@
 # file, those characters should be replaced with underscores in the
 # variable names as shown below.
 
-# Set rc_supervisor to use a program to monitor your daemons and restart
-# them when they crash.
-# Leaving this undefined uses start-stop-daemon, which is OpenRC's
-# default.
-#rc_supervisor=""
-
 # Some daemons are started and stopped via start-stop-daemon.
 # We can set some things on a per service basis, like the nicelevel.
 #SSD_NICELEVEL="-19"

diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index 4d286b2..67e47b7 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -125,6 +125,42 @@ _status()
 	fi
 }
 
+# Template start / stop / status functions
+# These functions select the appropriate function to call from the
+# supervisor modules
+start()
+{
+	local func=ssd_start
+	case "$supervisor" in
+		?*)
+			ewarn "Invalid supervisor, \"$supervisor\", using start-stop-daemon"
+			;;
+	esac
+	$func
+}
+
+stop()
+{
+	local func=ssd_stop
+	case "$supervisor" in
+		?*)
+			ewarn "Invalid supervisor, \"$supervisor\", using start-stop-daemon"
+			;;
+	esac
+	$func
+}
+
+status()
+{
+	local func=ssd_status
+	case "$supervisor" in
+		?*)
+			ewarn "Invalid supervisor, \"$supervisor\", using start-stop-daemon"
+			;;
+	esac
+	$func
+}
+
 yesno $RC_DEBUG && set -x
 
 _conf_d=${RC_SERVICE%/*}/../conf.d
@@ -146,14 +182,8 @@ unset _conf_d
 # Load any system overrides
 sourcex -e "@SYSCONFDIR@/rc.conf"
 
-# load a service supervisor
+# load service supervisor functions
 sourcex "@LIBEXECDIR@/sh/start-stop-daemon.sh"
-if [ -n "$rc_supervisor" ]; then
-	if ! sourcex -e "@LIBEXECDIR@/sh/${rc_supervisor}.sh"; then
-		ewarn "$rc_supervisor is an invalid value for rc_supervisor"
-		ewarn "Using the default."
-	fi
-fi
 
 # Set verbose mode
 if yesno "${rc_verbose:-$RC_VERBOSE}"; then

diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index aae6792..6a3e205 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -1,8 +1,8 @@
-# Default start / stop / status functions
+# start / stop / status functions for start-stop-daemon
 # Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
 # Released under the 2-clause BSD license.
 
-start()
+ssd_start()
 {
 	[ -n "$command" ] || return 0
 
@@ -45,7 +45,7 @@ start()
 	return 1
 }
 
-stop()
+ssd_stop()
 {
 	local startcommand="$(service_get_value "command")"
 	local startpidfile="$(service_get_value "pidfile")"
@@ -65,7 +65,7 @@ stop()
 	eend $? "Failed to stop $RC_SVCNAME"
 }
 
-status()
+ssd_status()
 {
 	_status
 }


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-11 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-11 14:50 [gentoo-commits] proj/openrc:master commit in: etc/, sh/ William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox