Package: sysv-rc
Version: 2.88dsf-55
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch utopic

Hello,

if you have a masked systemd unit, i. e. one that just points to
/dev/null, invoke-rc.d fails with error code 100:

| $ sudo sh -x /usr/sbin/invoke-rc.d cgroup-lite start
| [...]
| + test -d /run/systemd/system
| + is_systemd=1
| [...]
| + systemctl -p LoadState show cgroup-lite.service
| + _state=LoadState=masked
| + [ LoadState=masked != LoadState=masked ]
| + [  = 1 ]
| + [ -z  ]
| + test ! -f /etc/init.d/cgroup-lite
| + querypolicy
| + policyaction=start
| + test x = x101
| + test x/usr/sbin/policy-rc.d != x
| + test -x /usr/sbin/policy-rc.d
| + test x = x
| + RC=104
| + return
| + exit 100

As these units are meant to be no-ops, I think invoke-rc.d should
succeed instead of failing a package install/upgrade due to that.
Tested patch against current git attached (on top of the one in bug
#747851, but this only collides on debian/changelog).

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
>From 52acfe6c9e0dcbb40f81785416b1d726765c1267 Mon Sep 17 00:00:00 2001
From: Martin Pitt <[email protected]>
Date: Mon, 12 May 2014 11:24:03 +0200
Subject: [PATCH 2/2] invoke-rc.d: Don't fail if a systemd unit is masked.

A masked systemd unit (i. e. symlinked to /dev/null) is meant to be a no-op, so
just succeed in this case instead of erroring with code 100.

LP: #1312975
---
 debian/changelog                    | 1 +
 debian/src/sysv-rc/sbin/invoke-rc.d | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 9beb398..a97083a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,7 @@ sysvinit (2.88dsf-56) UNRELEASED; urgency=medium
   [ Martin Pitt ]
   * invoke-rc.d: Fix actions to run under systemd if there is no init.d
     script.
+  * invoke-rc.d: Don't fail if a systemd unit is masked. (LP: #1312975)
 
  -- Dimitri John Ledkov <[email protected]>  Tue, 22 Apr 2014 14:41:18 +0100
 
diff --git a/debian/src/sysv-rc/sbin/invoke-rc.d b/debian/src/sysv-rc/sbin/invoke-rc.d
index 2ce4abc..598fe22 100644
--- a/debian/src/sysv-rc/sbin/invoke-rc.d
+++ b/debian/src/sysv-rc/sbin/invoke-rc.d
@@ -395,6 +395,9 @@ elif [ -n "$is_systemd" ]; then
     _state=$(systemctl -p LoadState show "${UNIT}" 2>/dev/null)
     if [ "$_state" != "LoadState=masked" ]; then
         _executable=1
+    else
+        printerror Unit ${UNIT} is masked
+        exit 0
     fi
 elif testexec "${INITDPREFIX}${INITSCRIPTID}"; then
    _executable=1
-- 
2.0.0.rc0

_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-sysvinit-devel

Reply via email to