Package: runit-helper
Version: 2.8.14
Followup-For: Bug #942323

new patch attached

> What are user-visible consequences for existing users?

Few comes to my mind:

* In Sysv KNNfoo symlinks are visible, while here .foo symlink are hidden, so
  users that are unaware of this change might have an hard time to understand 
why
  services sometimes are not enabled by runit-helper. (using the NEWS file in 
runit might help ?)

* we need some user tool that allow to mark a service as wanted-disabled by
  local admin: while patches for init-system-helpers are stuck I though about
  update-service but:
  - there is no 'status' or similar command that checks and report if there is 
a .foo link
    (maybe enhance the --list command or add a new --status ?)
  - the change proposed in #942320 makes update-service a local-admin tool, so 
packages
    that still use it in maint scripts (like git-run) will become buggy, 
probably the
    maintainer deserves to be warned before change in update-service happens.
  
I think all the above should be dealt with in #942320 rather than here, but the 
two are
connected so consequences should be taken in account also here

Lorenzo

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

Kernel: Linux 4.20.3-van (SMP w/4 CPU cores; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: runit (via /run/runit.stopit)

-- no debconf information

-- debsums errors found:
debsums: changed file /lib/runit-helper/runit-helper (from runit-helper package)
>From b464896621a8eea6a2f2bc370f7d05ae9ddb9488 Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <lorenzo.r...@gmail.com>
Date: Fri, 18 Oct 2019 00:46:04 +0200
Subject: [PATCH] Use .link to mark a service as disabled

Use '.link' instead of removing 'link' to disable a service.
This allow to preserve local admin choice to disable a
service both on package upgrade and when the package is removed
but not purged.

Closes: #942323
---
 runit-helper | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/runit-helper b/runit-helper
index aedf290..1a5a1f2 100755
--- a/runit-helper
+++ b/runit-helper
@@ -21,12 +21,13 @@ set -e
 postinst () {
        local action="${1}" previous="${2:-}"
 
-       # Fresh installation (not upgrade). It is important to not override
-       # local admin decision (see #899242).
+       # It is important to not override local admin
+       # decision (see #899242 and 942323 ).
        if [ "${ENABLE}" = yes ] && \
-               dpkg --compare-versions "${previous}" '<<' "${SINCE}" ; then
+               [ ! -h "/etc/runit/runsvdir/default/.$NAME" ] ; then
                ln -sf "/etc/sv/$NAME" "/etc/runit/runsvdir/default/$NAME"
        fi
+       # ENABLE=no is always a no-op
 
        # Upgrade will changes destination of /etc/sv/{name}/supervise symlink 
from
        # /var/* to /run/*. If service was running, it important that its 
supervise
@@ -56,8 +57,12 @@ postrm () {
            return
        fi
 
+       # When "ENABLE=no" the $NAME link is an admin decision
+       # so we don't remove it.
        # Links in other runsvdirs is responsibility of administrator.
-       rm -f "/etc/runit/runsvdir/default/$NAME"
+       if [ "${action}" = 'remove' ] && [ "${ENABLE}" = yes ] ; then
+               rm -f "/etc/runit/runsvdir/default/$NAME"
+       fi
 
        # If runscript was never invoked, there will be no files
        # in this directory, and `dpkg' will remove it. In this case,
@@ -83,7 +88,10 @@ postrm () {
                        rmdir --ignore-fail-on-non-empty "$supervise"
                fi
        done
+
        if [ "${action}" = 'purge' ] ; then
+               rm -f "/etc/runit/runsvdir/default/$NAME"
+               rm -f "/etc/runit/runsvdir/default/.$NAME"
                readonly logdir="/var/log/runit/${NAME}"
                if [ -d "${logdir}" ] ; then
                        rm -r "${logdir}"
-- 
2.23.0

Reply via email to