Package: init-system-helpers
Version: 1.46
Severity: normal
Tags: patch
X-Debbugs-CC: Chris Lamb <[email protected]>, Niels Thykier <[email protected]>

Dear Maintainer,

As discussed on IRC we seem to agree that an init-less chroot which does
not have a policy-rc.d blocking service actions isn't a sane
configuration. This patch auto-detects the situation and skips running
the invoke-rc.d action (aka policy-rc.d code 101), unless --force was
given. In both situations a warning message is (also) printed.

Please see attached patch.

For further background see #838966 and #838997

(With this patch applied I hope we can get the change in #838997
reverted from lintian as I plainly think the check suggests a bad idea.)

Regards,
Andreas Henriksson
>From aee6f70eb7031d8f7baaca23b89e5639b02773d3 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <[email protected]>
Date: Wed, 9 Nov 2016 10:43:31 +0100
Subject: [PATCH] Do policy-rc.d automatically in init-less chroots

See #838966 and #838997 for background.

A debootstrap with --variant=minbase will have lsb-base installed,
so the person running into this issue must have:
 - not added a policy-rc.d in his init-less chroot
 - removed lsb-base manually (and what else?)

This patch auto-detects the situation with init-less chroot that's
missing a policy-rc.d and deals with it automatically (plus gives
a warning message).
---
 script/invoke-rc.d | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/script/invoke-rc.d b/script/invoke-rc.d
index ed9028d..6e0a05c 100755
--- a/script/invoke-rc.d
+++ b/script/invoke-rc.d
@@ -176,6 +176,15 @@ if test "x${POLICYHELPER}" != x && test -x "${POLICYHELPER}" ; then
 	 ;;
     esac
 else
+    if test ! -e "/sbin/init" ; then
+        if test x${FORCE} != x ; then
+            printerror "WARNING: No init system and policy-rc.d missing, but force specified so proceeding."
+        else
+            printerror "WARNING: No init system and policy-rc.d missing! Defaulting to block."
+            RC=101
+        fi
+    fi
+
     if test x${RC} = x ; then 
 	RC=104
     fi
-- 
2.10.2

Reply via email to