Merge pull request #1751 from mwhudson/no-oem-for-core

move oem configuration stuff to a separate method
This commit is contained in:
Michael Hudson-Doyle 2023-08-07 08:19:48 +12:00 committed by GitHub
commit e072ad0615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 88 additions and 41 deletions

View File

@ -0,0 +1,32 @@
#source-catalog: examples/sources/desktop.yaml
Source:
source: ubuntu-desktop
Welcome:
lang: en_US
Refresh:
update: no
Keyboard:
layout: us
Zdev:
accept-default: yes
Network:
accept-default: yes
Proxy:
proxy: ""
Mirror:
country-code: us
Filesystem:
guided: yes
guided-index: 0
Identity:
realname: Ubuntu
username: ubuntu
hostname: ubuntu-server
# ubuntu
password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1'
UbuntuPro:
token: ""
InstallProgress:
reboot: yes
Drivers:
install: no

View File

@ -224,6 +224,55 @@ class InstallController(SubiquityController):
device_map = json.load(fp)
self.app.controllers.Filesystem.update_devices(device_map)
async def pre_curthooks_oem_configuration(self, context):
async def install_oem_metapackages(ctx):
# 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.name, context=ctx)
if not self.model.network.has_network:
return
for pkg in self.model.oem.metapkgs:
source_list = f"/etc/apt/sources.list.d/{pkg.name}.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.name)
if not self.model.oem.metapkgs:
return
with context.child(
"install_oem_metapackages", "installing applicable OEM metapackages"
) as child:
await install_oem_metapackages(child)
@with_context(description="installing system", level="INFO", childlevel="DEBUG")
async def curtin_install(self, *, context, source):
if self.app.opts.dry_run:
@ -343,48 +392,14 @@ class InstallController(SubiquityController):
)
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.
if self.supports_apt():
await self.pre_curthooks_oem_configuration(context=context)
# 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.name)
if self.model.network.has_network:
for pkg in self.model.oem.metapkgs:
source_list = f"/etc/apt/sources.list.d/{pkg.name}.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.name)
# If we already have a kernel installed, don't bother requesting
# curthooks to install it again or we might end up with two
# kernels.
if await list_installed_kernels(Path(self.tpath())):
self.model.kernel.curthooks_no_install = True
# If we already have a kernel installed, don't bother requesting
# curthooks to install it again or we might end up with two
# kernels.
if await list_installed_kernels(Path(self.tpath())):
self.model.kernel.curthooks_no_install = True
await run_curtin_step(
name="curthooks",