On Fri, 27 Nov 2015 10:16:20 -0300 Felipe Sateler <fsate...@debian.org>
wrote:

> Attached is a patch that passes the -f flag to insserv when the file
> /etc/init.d/mountkernfs.sh is not present. This preserves the current
> behavior as long as initscripts is not purged, but allows (in the
> future, when package dependencies have been corrected) a systemd without
> the initscripts package. mountkernfs.sh is used as flag file to not fork
> a new process, and because it is the most heavily depended-upon service
> provided by initscripts.

I have pushed a patch rebased on init-system-helpers to the
missing-initstripts branch.

It is also attached for convenience.
From f762a73192a2caf1a713b8d6a62dd084fdacc637 Mon Sep 17 00:00:00 2001
From: Felipe Sateler <fsate...@debian.org>
Date: Wed, 27 Jan 2016 21:07:52 -0300
Subject: [PATCH] update-rc.d: Ensure insserv doesn't fail if initscripts is
 not installed

At some point in the future, it should be possible to install a system
without initscripts package. This means that insserv should ignore any
missing Requires-* package, because that information will be discarded
in a non-initscripts system; all we care about is the enable/disable
link. So pass -f to insserv, so that it still generates the link, even
when some dependencies are missing.

Closes: #806438
---
 script/update-rc.d | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/script/update-rc.d b/script/update-rc.d
index c05fd2c..ff3e6c2 100755
--- a/script/update-rc.d
+++ b/script/update-rc.d
@@ -168,6 +168,10 @@ sub insserv_updatercd {
 
     usage("not enough arguments") if ($#args < 1);
 
+    # Add force flag if initscripts is not installed
+    # This enables inistcripts-less systems to not fail when a facility is missing
+    unshift(@opts, '-f') unless is_initscripts_installed();
+
     $scriptname = shift @args;
     $action = shift @args;
     my $insserv = "/usr/lib/insserv/insserv";
@@ -385,3 +389,11 @@ sub insserv_toggle {
         rename($cur_lnk, join('', @new_lnk)) or error($!);
     }
 }
+
+# Try to determine if initscripts is installed
+sub is_initscripts_installed {
+    # Check if mountkernfs is available. We cannot make inferences
+    # using the running init system because we may be running in a
+    # chroot
+    return  -f '/etc/init.d/mountkernfs.sh';
+}
-- 
2.7.0

Reply via email to