mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-08-03 16:06:59 +00:00
fix(xcat-server): allow an online apt mirror for Ubuntu Subiquity installs
The Ubuntu live-server install media is not a complete apt package mirror.
With the generated apt configuration pinned to the media only, an install that
needs a package absent from the media stalls instead of fetching it. Emit an
online-mirror apt configuration when one is configured (site.ubuntu_apt_mirror)
so missing packages are retrieved from the archive; offline behaviour is
unchanged when it is unset.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 846e611772)
This commit is contained in:
committed by
Vinícius Ferrão
parent
67bcac1419
commit
44a4e40350
@@ -1652,12 +1652,50 @@ sub crydb_or_locked
|
||||
return '*';
|
||||
}
|
||||
|
||||
sub ubuntu_subiquity_apt_mirror
|
||||
{
|
||||
# Online apt mirror for Subiquity installs. When site.ubuntu_apt_mirror is set
|
||||
# (e.g. http://archive.ubuntu.com/ubuntu or a local full mirror), the generated
|
||||
# autoinstall apt config pulls from it so packages missing from the minimal
|
||||
# live-server install media are fetched over the network. Unset => keep the
|
||||
# airgapped file:///cdrom config (backward compatible).
|
||||
my $site_tab = xCAT::Table->new('site');
|
||||
return '' unless $site_tab;
|
||||
my $ent = $site_tab->getAttribs({ key => 'ubuntu_apt_mirror' }, 'value');
|
||||
return ($ent && defined($ent->{value}) && length($ent->{value})) ? $ent->{value} : '';
|
||||
}
|
||||
|
||||
sub ubuntu_subiquity_apt_config
|
||||
{
|
||||
my ($media_dir) = @_;
|
||||
my $use_deb822 = ubuntu_subiquity_uses_deb822_sources($media_dir);
|
||||
my @otherpkg_sources = ubuntu_subiquity_otherpkg_sources();
|
||||
|
||||
my $online_mirror = ubuntu_subiquity_apt_mirror();
|
||||
if ($online_mirror) {
|
||||
# Online install: use the configured archive as the primary apt mirror so
|
||||
# Subiquity/curtin can fetch whatever the minimal media lacks. No
|
||||
# disable_suites / offline fallback here -- updates & security stay enabled.
|
||||
my @lines = (
|
||||
' apt:',
|
||||
' preserve_sources_list: false',
|
||||
' geoip: false',
|
||||
' mirror-selection:',
|
||||
' primary:',
|
||||
" - uri: $online_mirror",
|
||||
);
|
||||
if (@otherpkg_sources) {
|
||||
push @lines, ' sources:';
|
||||
my $index = 0;
|
||||
foreach my $source (@otherpkg_sources) {
|
||||
push @lines, " xcat-otherpkgs-$index.list:";
|
||||
push @lines, qq( source: "deb [trusted=yes] $source ./");
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
return join( "\n", @lines );
|
||||
}
|
||||
|
||||
my @lines = (
|
||||
' apt:',
|
||||
' preserve_sources_list: false',
|
||||
|
||||
Reference in New Issue
Block a user