mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-10-22 07:38:08 +00:00
c87fec574b
Master merged #7835, which changed the Genesis base files under xCAT-genesis-builder/, the directory this branch removes. The merge keeps master's content at this branch's paths: - GenesisBuildRoot.pm, genesis_payload_verification.t and genesis_ubuntu_build_root.t take master's newer versions, pointed at xCAT-genesis-base/. - verify-genesis-payload and GenesisPayload.pm are identical on both sides; the copies at the old path are dropped. - buildrpms.pl keeps stage_genesis_base_sources(), which already stages what master added inline. - builddebs.pl and the new genesis_deb_per_codename.t now use xCAT-genesis-base/. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
89 lines
3.1 KiB
Perl
89 lines
3.1 KiB
Perl
package XCAT::GenesisBuildRoot;
|
|
|
|
# builddeb-genesis-base runs this module inside an Ubuntu build root, where only perl-base is
|
|
# installed. Use core modules only.
|
|
use strict;
|
|
use warnings;
|
|
use Exporter 'import';
|
|
|
|
our @EXPORT_OK = qw(required_packages apt_carries);
|
|
|
|
my @BASE_PACKAGES = qw(
|
|
dracut linux-image-generic
|
|
ipmitool lldpad ethtool iproute2 kexec-tools screen
|
|
openssh-server openssh-client rsyslog chrony
|
|
nfs-common rpcbind pciutils usbutils parted
|
|
dosfstools e2fsprogs lvm2 mdadm net-tools
|
|
bc psmisc rsync wget cpio
|
|
isc-dhcp-client ifenslave
|
|
systemd-sysv hwdata btrfs-progs netcat-openbsd iputils-ping fdisk ncurses-term
|
|
dpkg-dev debhelper fakeroot devscripts vim-tiny
|
|
);
|
|
|
|
# Two commands the image needs changed package between releases: nslookup left dnsutils for
|
|
# bind9-dnsutils in 22.04, and hwclock left util-linux for util-linux-extra in 23.04.
|
|
my @RENAMED_PACKAGES = ([qw(bind9-dnsutils dnsutils)], [qw(util-linux-extra util-linux)]);
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
=head3 apt_carries
|
|
|
|
Descriptions: ask apt-cache whether the release carries a package.
|
|
Arguments:
|
|
$package: the package name
|
|
Returns:
|
|
1 when apt-cache knows the package, 0 when it does not
|
|
|
|
=cut
|
|
|
|
#-------------------------------------------------------------------------------
|
|
sub apt_carries {
|
|
my ($package) = @_;
|
|
return system('sh', '-c', 'apt-cache show "$1" >/dev/null 2>&1', 'sh', $package) == 0
|
|
? 1 : 0;
|
|
}
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
=head3 required_packages
|
|
|
|
Descriptions: list the packages the Genesis build root needs.
|
|
For a renamed package, apt says which name the release carries, so the list does
|
|
not branch on the codename. 26.04 moved the backward-compatibility zone names that
|
|
the dracut module installs out of tzdata into tzdata-legacy.
|
|
Arguments:
|
|
$arch: the dpkg architecture (amd64, ppc64el)
|
|
$codename: the release name, used in the error message
|
|
$carries: optional code ref. It takes a package name and returns true when the
|
|
release carries that package. The default is apt_carries.
|
|
Returns:
|
|
the package names, in install order.
|
|
Dies with "ERROR: <codename> carries none of these packages: ..." when the release
|
|
carries neither name of a renamed package.
|
|
|
|
=cut
|
|
|
|
#-------------------------------------------------------------------------------
|
|
sub required_packages {
|
|
my ($arch, $codename, $carries) = @_;
|
|
$carries ||= \&apt_carries;
|
|
|
|
my @packages = @BASE_PACKAGES;
|
|
push @packages, qw(dmidecode efibootmgr) if $arch eq 'amd64';
|
|
|
|
RENAMED:
|
|
for my $alternatives (@RENAMED_PACKAGES) {
|
|
for my $package (@$alternatives) {
|
|
if ($carries->($package)) {
|
|
push @packages, $package;
|
|
next RENAMED;
|
|
}
|
|
}
|
|
die "ERROR: $codename carries none of these packages: @$alternatives\n";
|
|
}
|
|
push @packages, 'tzdata-legacy' if $carries->('tzdata-legacy');
|
|
return @packages;
|
|
}
|
|
|
|
1;
|