public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: williamh@gentoo.org
Subject: Re: [gentoo-dev] rfc: openrc use flag
Date: Wed, 20 Apr 2011 20:33:27 +0200	[thread overview]
Message-ID: <20110420203327.36ae5c7d@pomiocik.lan> (raw)
In-Reply-To: <20110420182253.GA12829@linux1>


[-- Attachment #1.1: Type: text/plain, Size: 1220 bytes --]

On Wed, 20 Apr 2011 13:22:53 -0500
William Hubbs <williamh@gentoo.org> wrote:

> On Wed, Apr 20, 2011 at 10:02:41PM +0400, Peter Volkov wrote:
> > В Срд, 20/04/2011 в 12:24 -0500, William Hubbs пишет:
> > > The author of the bug feels that the way to fix this is for us to
> > > put a check in openrc that makes it refuse to run services if it
> > > was not used in the boot process.
> > 
> > This is good idea to have in any case since I remember my system
> > went crazy after I've tried to start some service inside chroot.
> 
> My concern about it though is prefix installs. If I implement
> something like this, will it not break openrc on prefix systems?

I'm attaching the patch I suggested to fix the issue.

It is based on the assumption that in order to run cleanly, OpenRC
needs to do some cleanup in ${RC_SVCDIR} (e.g. to mark all services
stopped). It assumes that the basic effect of a running OpenRC
is a determined runlevel stored in ${RC_SVCDIR}/softlevel file.

I tested that approach with clean OpenRC and systemd installs, and it
doesn't create any issues. I'd appreciate if someone with Prefix system
could test it as well.


-- 
Best regards,
Michał Górny

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Add-a-check-for-softlevel-when-running-init.d-script.patch --]
[-- Type: text/x-patch, Size: 979 bytes --]

From ac70101ad50348fee636cea36cefcd473ee45690 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Wed, 20 Apr 2011 15:34:08 +0200
Subject: [PATCH] Add a check for softlevel when running init.d scripts.

${RC_SVCDIR}/softlevel should be a good file to check for before running
a OpenRC script. This should fix http://bugs.gentoo.org/show_bug.cgi?id=364159.
---
 src/rc/runscript.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index 0eca487..b7cc810 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -1112,6 +1112,11 @@ runscript(int argc, char **argv)
 		exit(EXIT_FAILURE);
 	}
 
+	if (!exists(RC_SVCDIR "/softlevel")) {
+		fprintf(stderr, "OpenRC is not running\n");
+		exit(EXIT_FAILURE);
+	}
+
 	if (stat(argv[1], &stbuf) != 0) {
 		fprintf(stderr, "runscript `%s': %s\n",
 		    argv[1], strerror(errno));
-- 
1.7.5.rc1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-04-20 18:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-20 17:24 [gentoo-dev] rfc: openrc use flag William Hubbs
2011-04-20 18:02 ` Peter Volkov
2011-04-20 18:20   ` Pacho Ramos
2011-04-21 19:30     ` William Hubbs
2011-04-21 20:03       ` Pacho Ramos
2011-04-21 20:52         ` William Hubbs
2011-04-22  9:50           ` Pacho Ramos
2011-04-22  8:26       ` Peter Volkov
2011-04-22  8:58         ` Michał Górny
2011-04-20 18:22   ` William Hubbs
2011-04-20 18:33     ` Michał Górny [this message]
2011-04-21  4:52       ` [gentoo-dev] " Duncan
2011-04-20 18:44     ` [gentoo-dev] " Fabian Groffen
2011-04-21  2:31   ` Jeroen Roovers
2011-04-21  4:34     ` William Hubbs
2011-04-21 19:05       ` William Hubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110420203327.36ae5c7d@pomiocik.lan \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=williamh@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox