Package: runit-init
Version: 2.1.2-56
Severity: important
Tags: patch
X-Debbugs-Cc: Helmut Grohne <[email protected]>, [email protected]

Hello,

If I undestrand correctly (there was a PM from Helmut explaining this
to me, but it was before [1]) runit init needs a conflicts with
molly-guard when it moves halt, poweroff, etc.. links from /sbin
to /usr/sbin. Now, following patches already applied to systemd
and reading [2], I'm attempting a patchset for runit-init.

[I know it's holiday time and I'm not in a rush for this]
Helmut, could you have a look (patches attached)?

* Is molly-guard enough or do I need to consider other packages?
  I'm excluding progress-linux-container and bfh-container since
  they depends on systemd-sysv
* the conflicts is in patch 003, restore the links is in 004
* note that for consistency I'm also moving runit's shutdown
  from /lib/runit/ to /usr/lib/runit. For that I have to bump
  the Depends to the latest runit (patch 001), I hope that it
  doesn't create issues to the apt resolver

Many thanks,
Lorenzo

[1] https://lists.debian.org/debian-devel/2023/12/msg00020.html
[2] https://lists.debian.org/debian-devel/2024/01/msg00025.html





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

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

Versions of packages runit-init depends on:
ii  getty-run    2.1.2-56
ii  initscripts  3.08-1
ii  insserv      1.24.0-1
ii  mount        2.39.2-1
ii  runit        2.1.2-56

Versions of packages runit-init recommends:
ii  runit-services  0.7.0

runit-init suggests no packages.

-- no debconf information
>From 798a86a24e582a20295741ef808121fe06abcba3 Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <[email protected]>
Date: Wed, 3 Jan 2024 15:01:17 +0100
Subject: [PATCH 1/4] runit: move shutdown to /usr/lib/runit

runit: move shutdown under /usr
runit-init: adjust symlink (halt,poweroff,shutdown,reboot) targets
   to point to /usr/lib/runit/shutdown; Depends on runit >= 2.1.2-57
---
 debian/control          | 2 +-
 debian/runit-init.links | 8 ++++----
 debian/runit.install    | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index 3e254a2..1fea2ed 100644
--- a/debian/control
+++ b/debian/control
@@ -71,7 +71,7 @@ Description: runscripts to supervise getty processes
 
 Package: runit-init
 Architecture: any
-Depends: runit (>= 2.1.2-43~), ${misc:Depends},
+Depends: runit (>= 2.1.2-57~), ${misc:Depends},
  ${shlibs:Depends}, getty-run, insserv, initscripts, mount [linux-any]
 Breaks: ${runit:Breaks}
 Replaces: systemd-sysv, sysvinit-core
diff --git a/debian/runit-init.links b/debian/runit-init.links
index 84d5822..ef10f73 100644
--- a/debian/runit-init.links
+++ b/debian/runit-init.links
@@ -4,9 +4,9 @@
 /usr/share/man/man8/runit-shutdown.8.gz /usr/share/man/man8/shutdown.8.gz
 /usr/share/man/man8/runit-init.8.gz     /usr/share/man/man8/init.8.gz
 /usr/share/man/man8/runit-runlevel.8.gz /usr/share/man/man8/runlevel.8.gz
-/lib/runit/shutdown   /sbin/halt
-/lib/runit/shutdown   /sbin/reboot
-/lib/runit/shutdown   /sbin/poweroff
-/lib/runit/shutdown   /sbin/shutdown
+/usr/lib/runit/shutdown   /sbin/halt
+/usr/lib/runit/shutdown   /sbin/reboot
+/usr/lib/runit/shutdown   /sbin/poweroff
+/usr/lib/runit/shutdown   /sbin/shutdown
 /lib/runit/runlevel   /sbin/runlevel
 /lib/runit/runit-init /sbin/init
diff --git a/debian/runit.install b/debian/runit.install
index 04c1954..4fc9bf9 100644
--- a/debian/runit.install
+++ b/debian/runit.install
@@ -27,7 +27,7 @@ debian/contrib/lib/trigger_sv   /lib/runit
 
 runit-2.1.2/src/runit-init          /lib/runit
 runit-2.1.2/src/runit               /sbin
-debian/contrib/shutdown             /lib/runit
+debian/contrib/shutdown             /usr/lib/runit
 debian/contrib/runlevel             /lib/runit
 debian/sv/sulogin/run                  /etc/runit/runsvdir/single/sulogin
 debian/sv/svlogd/                 /etc/sv/
-- 
2.40.1

>From 656e677e9a08eabcb27b2c13404b7acfd3cea83e Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <[email protected]>
Date: Wed, 3 Jan 2024 15:37:16 +0100
Subject: [PATCH 2/4] runit-init: move shutdown links to /usr/sbin/

* Move halt, poweroff, reboot, shutdown symlinks to /usr/sbin/
* update runit-shutdown(8) manpage in runit package
---
 debian/contrib/shutdown.8 | 8 ++++----
 debian/runit-init.links   | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/debian/contrib/shutdown.8 b/debian/contrib/shutdown.8
index 15590e5..cf6956d 100644
--- a/debian/contrib/shutdown.8
+++ b/debian/contrib/shutdown.8
@@ -2,13 +2,13 @@
 .SH NAME
 shutdown, reboot, poweroff \- poweroff or reboot the system
 .SH SYNOPSIS
-.B /sbin/shutdown [-h] [-r] [-f] [-F] [now]
+.B /usr/sbin/shutdown [-h] [-r] [-f] [-F] [now]
 .br
-.B /sbin/reboot [-w] [-f] [-n]
+.B /usr/sbin/reboot [-w] [-f] [-n]
 .br
-.B /sbin/halt [-w] [-f] [-n]
+.B /usr/sbin/halt [-w] [-f] [-n]
 .br
-.B /sbin/poweroff [-w] [-f] [-n]
+.B /usr/sbin/poweroff [-w] [-f] [-n]
 .SH DESCRIPTION
 .BR Shutdown
 is a program to poweroff or reboot the system that maintains some 
compatibility with
diff --git a/debian/runit-init.links b/debian/runit-init.links
index ef10f73..badfbbe 100644
--- a/debian/runit-init.links
+++ b/debian/runit-init.links
@@ -4,9 +4,9 @@
 /usr/share/man/man8/runit-shutdown.8.gz /usr/share/man/man8/shutdown.8.gz
 /usr/share/man/man8/runit-init.8.gz     /usr/share/man/man8/init.8.gz
 /usr/share/man/man8/runit-runlevel.8.gz /usr/share/man/man8/runlevel.8.gz
-/usr/lib/runit/shutdown   /sbin/halt
-/usr/lib/runit/shutdown   /sbin/reboot
-/usr/lib/runit/shutdown   /sbin/poweroff
-/usr/lib/runit/shutdown   /sbin/shutdown
+/usr/lib/runit/shutdown   /usr/sbin/halt
+/usr/lib/runit/shutdown   /usr/sbin/reboot
+/usr/lib/runit/shutdown   /usr/sbin/poweroff
+/usr/lib/runit/shutdown   /usr/sbin/shutdown
 /lib/runit/runlevel   /sbin/runlevel
 /lib/runit/runit-init /sbin/init
-- 
2.40.1

>From 64862daa5e4d6c2c40eec26f3d8647679f5e30b6 Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <[email protected]>
Date: Wed, 3 Jan 2024 15:48:00 +0100
Subject: [PATCH 3/4] runit-init: versioned conflicts with molly-guard

Add conflicts with molly-guard(<< 0.8.3) due to usrmerge DEP17P3,
applying M18 mitigation
---
 debian/control | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 1fea2ed..03ddd32 100644
--- a/debian/control
+++ b/debian/control
@@ -75,7 +75,7 @@ Depends: runit (>= 2.1.2-57~), ${misc:Depends},
  ${shlibs:Depends}, getty-run, insserv, initscripts, mount [linux-any]
 Breaks: ${runit:Breaks}
 Replaces: systemd-sysv, sysvinit-core
-Conflicts: systemd-sysv, sysvinit-core, libnss-systemd
+Conflicts: systemd-sysv, sysvinit-core, libnss-systemd, molly-guard (<< 0.8.3~)
 Recommends: runit-services
 Description: system-wide service supervision (as init system)
  runit is a collection of tools to provide system-wide service supervision
-- 
2.40.1

>From 070894bea2c45f65d210f9fbd58e10699d718e4f Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <[email protected]>
Date: Wed, 3 Jan 2024 18:59:42 +0100
Subject: [PATCH 4/4] runit-init: restore lost symlinks due to usrmerge

restore diverted symlinks if they are lost due to usrmerge
---
 debian/runit-init.postinst | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 debian/runit-init.postinst

diff --git a/debian/runit-init.postinst b/debian/runit-init.postinst
new file mode 100644
index 0000000..6414f08
--- /dev/null
+++ b/debian/runit-init.postinst
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -e
+
+# begin-remove-after: released:trixie
+if [ "$1" = "configure" ]; then
+       for n in halt poweroff reboot shutdown; do
+               fn=$(dpkg-divert --truename "/usr/sbin/$n")
+               if ! test -h "$fn"; then
+                       if test "$fn" = "/usr/sbin/$n"; then
+                               echo "/usr/sbin/$n vanished in /usr-merge 
upgrade. Restoring."
+                       else
+                               echo "/usr/sbin/$n (diverted to $fn) vanished 
in /usr-merge upgrade. Restoring."
+                       fi
+                       ln -sf  /usr/lib/runit/shutdown "$fn"
+               fi
+       done
+fi
+# end-remove-after
+
+
+#DEBHELPER#
-- 
2.40.1

Reply via email to