Bug#629902: dh_installinit: should support LSB compliant scripts

Dmitry Bogatov KAction at debian.org
Fri Jan 11 12:37:09 GMT 2019


control: tags -1 +patch


[2011-06-14 11:39] Joey Hess <joeyh at debian.org>
>
> part 1     text/plain                 618
> Helmut Grohne wrote:
> > A failure from the update-rc.d cannot make postinst fail, because the
> > exit code is not checked. 
> 
> Yes it is (set -x), but I meant invoke-rc.d anyway, obviously.
> 
> > So in my view the reason for a postinst failure is unrelated to
> > update-rc.d. Can you explain your reasoning?
> 
> Simple separation of concerns, invoke-rc.d is responsible for running
> the init script and determining if it fails and propigating a failing
> exit status. debhelper allows it to do do. The right way to make 6 be
> ignored is to get invoke-rc.d to ignore it, not add cruft to every
> postinst that calls it.

Here I propose patch to implement just that:

From 77c189d0f87a53a93f48b08594c8e7ee864b6e5e Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <KAction at debian.org>
Date: Thu, 10 Jan 2019 16:31:32 +0000
Subject: [PATCH] invoke-rc.d: exit value 6 from init script is fine

Consider exit value 6 from init script (service not configured) as
successful invocation (Closes: #629902)
---
 script/invoke-rc.d | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/script/invoke-rc.d b/script/invoke-rc.d
index 80e8401..d4ac2c6 100755
--- a/script/invoke-rc.d
+++ b/script/invoke-rc.d
@@ -554,9 +554,11 @@ if test x${FORCE} != x || test ${RC} -eq 104 ; then
 	    elif [ -n "$is_openrc" ]; then
 		rc-service "${INITSCRIPTID}" "${saction}" && exit 0
 	    else
-		"${INITDPREFIX}${INITSCRIPTID}" "${saction}" "$@" && exit 0
+		"${INITDPREFIX}${INITSCRIPTID}" "${saction}" "$@"
 	    fi
 	    RC=$?
+	    [ "${RC}" = 0 ] && exit 0
+	    [ "${RC}" = 6 ] && exit 0 # service not configured. See #629902
 
 	    if test ! -z "${ACTION}" ; then
 		printerror action \"${saction}\" failed, trying next action...



More information about the Pkg-systemd-maintainers mailing list