Package: init-system-helpers Version: 1.60+nmu1 Severity: wishlist Tags: patch User: debian-d...@lists.debian.org Usertags: dpkg-root-support
Hi, if dpkg (since 1.18.5) is run with --force-script-chrootless, it sets the variable DPKG_ROOT to the directory into which dpkg will install the requested packages. This is useful for bootstrapping, creating chroots for foreign architectures where utilities from inside the chroot cannot be executed, avoiding dependency loops between postinst scripts, installation without requiring superuser privileges and for creating installations that do not even contain dpkg. See https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap for more information. Currently, when maintainer scripts are run, /usr/sbin/policy-rc.d is checked to avoid starting services. But instead, the scripts should check "$DPKG_ROOT/usr/sbin/policy-rc.d". In normal situations, the $DPKG_ROOT variable is empty, so this will work as usual. But if dpkg is run with --root and --force-script-chrootless then /usr/sbin/policy-rc.d from the new root directory will be used. Please consider applying the following patch: diff --git a/script/deb-systemd-invoke b/script/deb-systemd-invoke index d8dab1a..67e3e1d 100755 --- a/script/deb-systemd-invoke +++ b/script/deb-systemd-invoke @@ -58,6 +58,9 @@ if (@ARGV < 2) { } my $policyhelper = '/usr/sbin/policy-rc.d'; +if (defined $ENV{DPKG_ROOT} && $ENV{DPKG_ROOT} ne "") { + $policyhelper = $ENV{DPKG_ROOT} . $policyhelper; +} my @units = @ARGV; my $action = shift @units; if (-x $policyhelper) { diff --git a/script/invoke-rc.d b/script/invoke-rc.d index 71cc3f1..ca1bdbe 100755 --- a/script/invoke-rc.d +++ b/script/invoke-rc.d @@ -23,7 +23,7 @@ # Constants RUNLEVELHELPER=/sbin/runlevel -POLICYHELPER=/usr/sbin/policy-rc.d +POLICYHELPER=$DPKG_ROOT/usr/sbin/policy-rc.d INITDPREFIX=/etc/init.d/ RCDPREFIX=/etc/rc Thanks! cheers, josch