From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-974402-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 103751396D0
	for <garchives@archives.gentoo.org>; Fri, 22 Sep 2017 22:25:55 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 37F3223418A;
	Fri, 22 Sep 2017 22:25:54 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 1656C23418A
	for <gentoo-commits@lists.gentoo.org>; Fri, 22 Sep 2017 22:25:53 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 02265341301
	for <gentoo-commits@lists.gentoo.org>; Fri, 22 Sep 2017 22:25:53 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id C61C39086
	for <gentoo-commits@lists.gentoo.org>; Fri, 22 Sep 2017 22:25:50 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1506118970.1ccba056584ee1a8e09fb1d5eebd988b47912c06.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: sh/
X-VCS-Repository: proj/openrc
X-VCS-Files: sh/rc-functions.sh.in
X-VCS-Directories: sh/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 1ccba056584ee1a8e09fb1d5eebd988b47912c06
X-VCS-Branch: master
Date: Fri, 22 Sep 2017 22:25:50 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: be9f0af9-da39-4318-aed1-f928f1536f29
X-Archives-Hash: 4374841d49f50023019d56aa42894bd8

commit:     1ccba056584ee1a8e09fb1d5eebd988b47912c06
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Sep 22 22:22:50 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Sep 22 22:22:50 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=1ccba056

sh/rc-functions.sh: add need_if_exists convenience function

 sh/rc-functions.sh.in | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
index 7b771f82..d6336a18 100644
--- a/sh/rc-functions.sh.in
+++ b/sh/rc-functions.sh.in
@@ -119,6 +119,13 @@ get_bootparam_value()
 	echo $result
 }
 
+need_if_exists()
+{
+	for x; do
+		rc-service --exists "${x}" && need "${x}"
+	done
+}
+
 # Called from openrc-run.sh or gendepends.sh
 _get_containers() {
 	local c