explicitly add systemd-syv to required packages for systemd based releases

This fixes template creations for some newer releases that do not have
the `init` meta package as "required" priority anymore, like Ubuntu
24.04.

Without that the /sbin/init did not exist after unpacking the required
packages, which broke DABs assumption it holds when creating a
diversion for the PID 1 init for bootstrap setup.

The order of events went as follows:

1. extract required packages
2. rename init to init.org (but no init exists at this point)
3. copy fake init to init (that works)
4. unpack required packages
5. rename init.org to init (doesn't work, since 2 failed)
6. divert init (still fake init!) to init.distrib
7. copy fake init (again) to init
8. .. install, including now really installing systemd-sysv which
   overwrites init
9. remove divert, copying back fake init to init

So, in the end the CT image shipped the very basic DAB init, which was
only intended to be used for during the appliance building process.

Fix this by explicitly adding `systemd-sysv` as required package for
all distros and releases using systemd.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-05-07 09:36:47 +02:00
parent a4fd2e2b84
commit d2e70cf306

View File

@ -1288,6 +1288,11 @@ sub bootstrap {
my $required; my $required;
my $standard; my $standard;
# some releases do not have the init metapackage in the rquired set anymore, but DAB assumes
# that, so explicitly add systemd-sysv, which provides the /sbin/init symlink to systemd.
my $add_systemd_sysv_as_required = $suiteinfo->{flags}->{systemd};
push @$required, 'systemd-sysv' if $add_systemd_sysv_as_required;
my $mta = $opts->{exim} ? 'exim' : 'postfix'; my $mta = $opts->{exim} ? 'exim' : 'postfix';
if ($mta eq 'postfix') { if ($mta eq 'postfix') {
push @$important, "postfix"; push @$important, "postfix";