oem: install (and upgrade) OEM meta-packages if available

When OEM meta-packages are available, install them before running
curthooks. If we are online, we also upgrade the metapackages so that
they are upgraded to their version in the relevant OEM archive. This
will effectively pull the kernel.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2023-06-15 15:44:56 +02:00
parent 64aabc1dd0
commit 6123601cba
1 changed files with 30 additions and 0 deletions

View File

@ -306,6 +306,36 @@ class InstallController(SubiquityController):
source=source, source=source,
) )
await self.setup_target(context=context) await self.setup_target(context=context)
# For OEM, we basically mimic what ubuntu-drivers does:
# 1. Install each package with apt-get install
# 2. For each package, run apt-get update using only the source
# installed by said package.
# 3. Run apt-get install again for each package. This will upgrade
# them to the version found in the OEM archive.
# NOTE In ubuntu-drivers, this is done in a single call to apt-get
# install.
for pkg in self.model.oem.metapkgs:
await self.install_package(package=pkg)
if self.model.network.has_network:
for pkg in self.model.oem.metapkgs:
source_list = f"/etc/apt/sources.list.d/{pkg}.list"
await run_curtin_command(
self.app, context,
"in-target", "-t", self.tpath(), "--",
"apt-get", "update",
"-o", f"Dir::Etc::SourceList={source_list}",
"-o", "Dir::Etc::SourceParts=/dev/null",
"--no-list-cleanup",
private_mounts=False)
# NOTE In ubuntu-drivers, this is done in a single call to
# apt-get install.
for pkg in self.model.oem.metapkgs:
await self.install_package(package=pkg)
await run_curtin_step( await run_curtin_step(
name="curthooks", stages=["curthooks"], name="curthooks", stages=["curthooks"],
step_config=self.generic_config(), step_config=self.generic_config(),