From fd730a88b3b340a4d78ee2388adf5ca47afb9fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= 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 | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 0eca487..b1525a4 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -1112,6 +1112,13 @@ runscript(int argc, char **argv) exit(EXIT_FAILURE); } + if (!exists(RC_SVCDIR "/softlevel")) { + fprintf(stderr, "OpenRC is not running. Running the script may result in unexpected\n" + "behavior. If you'd like to force doing so, please run:\n" + "\ttouch " RC_SVCDIR "/softlevel\n"); + exit(EXIT_FAILURE); + } + if (stat(argv[1], &stbuf) != 0) { fprintf(stderr, "runscript `%s': %s\n", argv[1], strerror(errno)); -- 1.7.5.rc3