bootstrap: die if init binary could not get diverted

This is a safe guard check, as otherwise DAB might end up putting the
wrong 'init' executable in the final image, like it happened for
Ubuntu 24.04 before the fixing commit d2e70cf ("explicitly add
systemd-syv to required packages for systemd based releases").

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-05-07 11:04:08 +02:00
parent d2e70cf306
commit 267c2ecc9e

View File

@ -1430,7 +1430,8 @@ sub bootstrap {
write_file ("LANG=\"C\"\n", "$rootdir/etc/default/locale", 0644);
# fake init
rename ("$rootdir/sbin/init", "$rootdir/sbin/init.org");
rename ("$rootdir/sbin/init", "$rootdir/sbin/init.org")
or die "failed to backup distro 'init' for manual diversion - $!";
$self->run_command ("cp '$fake_init' '$rootdir/sbin/init'");
$self->run_command ("cp '$default_env' '$rootdir/sbin/defenv'");
@ -1464,7 +1465,8 @@ sub bootstrap {
$self->ve_dpkg ('unpack', $p);
}
rename ("$rootdir/sbin/init.org", "$rootdir/sbin/init");
rename ("$rootdir/sbin/init.org", "$rootdir/sbin/init")
or die "failed to restore distro 'init' for actual diversion - $!";
$self->ve_divert_add ("/sbin/init");
$self->run_command ("cp '$fake_init' '$rootdir/sbin/init'");