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 C82D8138332 for ; Tue, 15 May 2018 22:11:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 58BBEE083B; Tue, 15 May 2018 22:11:23 +0000 (UTC) Received: from smtp.gentoo.org (mail.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 3296CE083B for ; Tue, 15 May 2018 22:11:23 +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 C172F335C60 for ; Tue, 15 May 2018 22:11:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 568A629E for ; Tue, 15 May 2018 22:11:20 +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: <1526421561.4d47ce440c3e8f193cff82a77e6691ee6e7fac33.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: man/, src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: man/rc-service.8 src/rc/rc-service.c X-VCS-Directories: man/ src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 4d47ce440c3e8f193cff82a77e6691ee6e7fac33 X-VCS-Branch: master Date: Tue, 15 May 2018 22:11:20 +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: ab0f9a5c-b381-49c8-9c9a-7932480c83d4 X-Archives-Hash: e5fc459a2e8f2896b72f2603edb21de2 commit: 4d47ce440c3e8f193cff82a77e6691ee6e7fac33 Author: William Hubbs gmail com> AuthorDate: Tue May 15 21:59:21 2018 +0000 Commit: William Hubbs gentoo org> CommitDate: Tue May 15 21:59:21 2018 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=4d47ce44 rc-service: add -d/--debug and -D/--nodeps options man/rc-service.8 | 14 ++++++++++++++ src/rc/rc-service.c | 12 +++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/man/rc-service.8 b/man/rc-service.8 index a0202a8e..3613f8b8 100644 --- a/man/rc-service.8 +++ b/man/rc-service.8 @@ -20,6 +20,14 @@ .Ar service cmd .Op Ar ... .Nm +.Fl d , -debug +.Ar service cmd +.Op Ar ... +.Nm +.Fl D , -nodeps +.Ar service cmd +.Op Ar ... +.Nm .Op Fl i , -ifexists .Ar service cmd .Op Ar ... @@ -72,6 +80,12 @@ otherwise -1. .Fl r , -resolve does the same and also prints the full path of the service to stdout. .Pp +.Fl d , -debug +sets -x when running the service script(s). +.Pp +.Fl D , -nodeps +ignores dependencies when running the service. +.Pp .Fl Z , -dry-run prints out the commands it would execute rather than executing them. .Sh SEE ALSO diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c index 77f0336b..ea69dab5 100644 --- a/src/rc/rc-service.c +++ b/src/rc/rc-service.c @@ -29,8 +29,10 @@ const char *applet = NULL; const char *extraopts = NULL; -const char *getoptstring = "ce:ilr:INZ" getoptstring_COMMON; +const char *getoptstring = "cdDe:ilr:INZ" getoptstring_COMMON; const struct option longopts[] = { + { "debug", 0, NULL, 'd' }, + { "nodeps", 0, NULL, 'D' }, { "exists", 1, NULL, 'e' }, { "ifcrashed", 0, NULL, 'c' }, { "ifexists", 0, NULL, 'i' }, @@ -42,6 +44,8 @@ const struct option longopts[] = { longopts_COMMON }; const char * const longopts_help[] = { + "set xtrace when running the command", + "ignore dependencies", "tests if the service exists or not", "if the service is crashed then run the command", "if the service exists then run the command", @@ -78,6 +82,12 @@ int main(int argc, char **argv) longopts, (int *) 0)) != -1) { switch (opt) { + case 'd': + setenv("RC_DEBUG", "yes", 1); + break; + case 'D': + setenv("RC_NODEPS", "yes", 1); + break; case 'e': service = rc_service_resolve(optarg); opt = service ? EXIT_SUCCESS : EXIT_FAILURE;