Package: runit
Version: 2.1.2-35
Severity: wishlist
Tags: patch

Hi,

this is to be consistent with a patch that I'm about to send
for dh-runit.
The attached patch here makes update-service create a .symlink
rather than just removing the symlink to disable a service.
This will help in preserving local admin choice to keep a service disabled.
I've added some detail in the man page but I hope to provide some more
detailed info in update-rc.d man page as runit support is merged there.

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)

Versions of packages runit depends on:
ii  libc6           2.29-2
ii  sysuser-helper  1.3.3

Versions of packages runit recommends:
ii  runit-init  2.1.2-35

runit suggests no packages.

-- Configuration Files:
/etc/default/runit changed [not included]
/etc/runit/3 changed [not included]

-- no debconf information

-- debsums errors found:
debsums: changed file /sbin/update-service (from runit package)
>From d6369d7e8cfee3473f525940aa02a1d846090671 Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <[email protected]>
Date: Mon, 14 Oct 2019 13:47:30 +0200
Subject: [PATCH] Use dot-symlink to mark a service as disabled

When removing a service with update-service, replace 'service'
with a '.service' symlink rather than removing the symlink.
This is done to preserve the local admin choice to disable a
service.
---
 debian/contrib/update-service   |  4 ++++
 debian/contrib/update-service.8 | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/debian/contrib/update-service b/debian/contrib/update-service
index 7e72501..d393b78 100644
--- a/debian/contrib/update-service
+++ b/debian/contrib/update-service
@@ -70,6 +70,9 @@ case "$opt" in
         ln -s /var/lib/runit/log/supervise/"$sv" "$svdir"/log/supervise
       fi
     fi
+    if [ -d "$servicedir"/."$sv" ]; then
+        rm "$servicedir"/."$sv"
+    fi
     ln -s "$svdir" "$servicedir"/"$sv"
     printf '%s\n' "Service $sv added."
     exit 0
@@ -85,6 +88,7 @@ case "$opt" in
         test "$relsymdir"/"$sv" = "$(readlink "$servicedir"/"$sv")" ||
           fatal "$servicedir/$sv does not point to $svdir."
     rm -f "$servicedir"/"$sv"
+    ln -s "$svdir" "$servicedir"/."$sv"
     printf '%s %s\n' \
       "Service $sv removed," \
       "the service daemon received the TERM and CONT signals."
diff --git a/debian/contrib/update-service.8 b/debian/contrib/update-service.8
index a45e113..e8686a8 100644
--- a/debian/contrib/update-service.8
+++ b/debian/contrib/update-service.8
@@ -89,6 +89,26 @@ program to control the removed service, or query its status, 
e.g.:
 # sv status
 .I service-directory
 
+When the service directory
+.IR service-directory
+is removed, the service
+.I service-name
+will be marked as disabled by creating a
+.I .service-name
+symlink. This will prevent tools like
+.BR dh_runit (1)
+and runit-helper from auto-enabling
+.I service-name
+at install or upgrade of the package that ships
+.IR service-directory .
+The
+.I .service-name
+symlink will be removed as the
+.IR service-directory
+is added again to the system-wide service supervision or when the package that 
ships
+.IR service-directory
+is purged.
+
 .TP
 .B \--list | \-l
 If
-- 
2.23.0

Reply via email to