Package: sysv-rc
Version: 2.88dsf-59.2
Severity: normal
Tags: patch
User: pkg-systemd-maintain...@lists.alioth.debian.org
Usertags: integration

Hi,

In order to allow systems that do not require initscripts, update-rc.d
needs to cope with the services it provides being missing. Currently, if
initscripts is missing, the packages that specify a Requires-* LSB
dependency will fail to configure, as insserv will return with an error,
because it cannot compute a correct ordering sequence.

On systemd systems, however, the ordering sequence is not used, and all
that is required is that enable/disable links are present. So in systemd
systems we can force insserv to generate the links even if the ordering
is wrong.

If a systemd-only system then installs initscripts, because initscripts
calls update-rc.d in postinst, that will recompute the sequences, so the
correct ordering should be reestablished afterwards.

Allowing this change would enable many packages to drop their dependency
against initscripts, which are currently only required for this reason.

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.

Additional information and motivation at:

http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/2015-November/009674.html
https://bugs.debian.org/cgi-bin/pkgreport.cgi?users=pkg-systemd-maintain...@lists.alioth.debian.org;dist=unstable;tag=initscripts-dep

Saludos

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages sysv-rc depends on:
ii  debconf [debconf-2.0]  1.5.58
ii  insserv                1.14.0-5
ii  startpar               0.59-3
ii  sysvinit-utils         2.88dsf-59.2

Versions of packages sysv-rc recommends:
ii  lsb-base  9.20150917

Versions of packages sysv-rc suggests:
pn  bum  <none>

-- debconf information excluded
>From e69e187e24ba56f12a28fae85d2925bc5723780a Mon Sep 17 00:00:00 2001
From: Felipe Sateler <fsate...@debian.org>
Date: Fri, 27 Nov 2015 09:46:07 -0300
Subject: [PATCH] update-rc.d: Ensure insserv doesn't fail 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.
---
 debian/src/sysv-rc/sbin/update-rc.d | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/debian/src/sysv-rc/sbin/update-rc.d b/debian/src/sysv-rc/sbin/update-rc.d
index a631021..59aeac2 100755
--- a/debian/src/sysv-rc/sbin/update-rc.d
+++ b/debian/src/sysv-rc/sbin/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";
@@ -380,3 +384,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.6.2

Reply via email to