From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DE039139083 for ; Thu, 14 Dec 2017 18:53:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 127FDE1091; Thu, 14 Dec 2017 18:53:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 D66E7E1091 for ; Thu, 14 Dec 2017 18:53:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 CF54433BEC7 for ; Thu, 14 Dec 2017 18:53:06 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 29A5DAE7B for ; Thu, 14 Dec 2017 18:53:05 +0000 (UTC) From: "William Hubbs" 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" Message-ID: <1513277523.bb1bc6eeb73b3483a1ebdfc142a11240b58588cf.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: init.d/ X-VCS-Repository: proj/openrc X-VCS-Files: init.d/local.in X-VCS-Directories: init.d/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: bb1bc6eeb73b3483a1ebdfc142a11240b58588cf X-VCS-Branch: master Date: Thu, 14 Dec 2017 18:53:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d6c65b2c-2ac6-489e-95cb-9b97d92b524e X-Archives-Hash: d7c63961f192aa1eb7d6942fa43dd90d commit: bb1bc6eeb73b3483a1ebdfc142a11240b58588cf Author: William Hubbs gmail com> AuthorDate: Thu Dec 14 18:44:45 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Thu Dec 14 18:52:03 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=bb1bc6ee local: misc cleanups Remove references to @SYSCONFDIR@ since these can be calculated at runtime. Also style fixes. init.d/local.in | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/init.d/local.in b/init.d/local.in index 001a4fb1..2bb1696c 100644 --- a/init.d/local.in +++ b/init.d/local.in @@ -9,7 +9,10 @@ # This file may not be copied, modified, propagated, or distributed # except according to the terms contained in the LICENSE file. -description="Executes user programs in @SYSCONFDIR@/local.d" +conf_d_dir="${RC_SERVICE%/*/*}/conf.d" +local_d_dir="${RC_SERVICE%/*/*}/local.d" + +description="Executes user programs in ${local_d_dir}" depend() { @@ -19,12 +22,12 @@ depend() start() { - ebegin "Starting local" - - local file has_errors=0 redirect retval + local file has_errors redirect retval + has_errors=0 yesno $rc_verbose || redirect='> /dev/null 2>&1' + ebegin "Starting local" eindent - for file in @SYSCONFDIR@/local.d/*.start; do + for file in "${local_d_dir}"/*.start; do if [ -x "${file}" ]; then vebegin "Executing \"${file}\"" eval "${file}" $redirect @@ -38,32 +41,32 @@ start() eoutdent if command -v local_start >/dev/null 2>&1; then - ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed." + ewarn "\"${conf_d_dir}/local\" should be removed." ewarn "Please move the code from the local_start function" ewarn "to executable scripts with an .start extension" - ewarn "in \"@SYSCONFDIR@/local.d\"" + ewarn "in \"${local_d_dir}\"" local_start fi eend ${has_errors} # We have to end with a zero exit code, because a failed execution - # of an executable @SYSCONFDIR@/local.d/*.start file shouldn't result in + # of an executable ${local_d_dir}/*.start file shouldn't result in # marking the local service as failed. Otherwise we are unable to - # execute any executable @SYSCONFDIR@/local.d/*.stop file, because a failed + # execute any executable ${local_d_dir}/*.stop file, because a failed # marked service cannot be stopped (and the stop function would - # actually call the executable @SYSCONFDIR@/local.d/*.stop file(s)). + # actually call the executable ${local_d_dir}/*.stop file(s)). return 0 } stop() { - ebegin "Stopping local" - - local file has_errors=0 redirect retval + local file has_errors redirect retval + has_errors=0 yesno $rc_verbose || redirect='> /dev/null 2>&1' + ebegin "Stopping local" eindent - for file in @SYSCONFDIR@/local.d/*.stop; do + for file in "${local_d_dir}"/*.stop; do if [ -x "${file}" ]; then vebegin "Executing \"${file}\"" eval "${file}" $redirect @@ -77,16 +80,16 @@ stop() eoutdent if command -v local_stop >/dev/null 2>&1; then - ewarn "\"@SYSCONFDIR@/conf.d/local\" should be removed." + ewarn "\"${conf_d_dir}/local\" should be removed." ewarn "Please move the code from the local_stop function" ewarn "to executable scripts with an .stop extension" - ewarn "in \"@SYSCONFDIR@/local.d\"" + ewarn "in \"${local_d_dir}\"" local_stop fi eend ${has_errors} - # An executable @SYSCONFDIR@/local.d/*.stop file which failed with a + # An executable ${local_d_dir}/*.stop file which failed with a # non-zero exit status is not a reason to mark this service # as failed, therefore we have to end with a zero exit code. return 0