Josch,

Thanks for this.

On Tue, Apr 14, 2026 at 03:09:46PM +0200, Johannes Schauer Marin Rodrigues 
wrote:
> I changed my patch to this:
> 
> --- a/script/update-rc.d
> +++ b/script/update-rc.d
> @@ -192,6 +192,10 @@ sub create_sequence {
>      $insserv = "/sbin/insserv" if ( -x "$dpkg_root/sbin/insserv");
>      # If insserv is not configured it is not fully installed
>      my $insserv_installed = -x "$dpkg_root$insserv" && -e 
> "$dpkg_root/etc/insserv.conf";
> +    # Ignore the presence of insserv if this system is using systemd as init
> +    if ($insserv_installed && readlink "$dpkg_root/usr/sbin/init" eq 
> "../lib/systemd/systemd") {
> +        $insserv_installed = 0;
> +    }
>      my @opts;
>      push(@opts, '-f') if $force;
>      # Add force flag if initscripts is not installed

This looks sane to me. Obviously the readlink test could be combined with the my
declaration:

     my $insserv_installed = -x "$dpkg_root$insserv" &&
     -e "$dpkg_root/etc/insserv.conf" &&
     readlink "$dpkg_root/usr/sbin/init" ne "../lib/systemd/systemd";

But that is just sugar.

> I don't think it would be correct to check /run/systemd/system as I proposed
> earlier because that would allow us to find out whether systemd is the init
> system currently running but we want to find out which init system the system
> is going to use.

I agree.

> What else do I have to check?

LGTM.

Thanks for taking this on.

Mark

Reply via email to