Skip to content

Commit

Permalink
move oem configuration stuff to a separate method
Browse files Browse the repository at this point in the history
and do not call it when installing core
  • Loading branch information
mwhudson committed Aug 2, 2023
1 parent f088fa2 commit 63dbc2d
Showing 1 changed file with 47 additions and 42 deletions.
89 changes: 47 additions & 42 deletions subiquity/server/controllers/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,51 @@ async def run_curtin_step(
device_map = json.load(fp)
self.app.controllers.Filesystem.update_devices(device_map)

@with_context(description="configuring OEM packages")
async def pre_curthooks_oem_configuration(self, 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.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

@with_context(description="installing system", level="INFO", childlevel="DEBUG")
async def curtin_install(self, *, context, source):
if self.app.opts.dry_run:
Expand Down Expand Up @@ -340,48 +385,8 @@ async def run_curtin_step(name, stages, step_config, source=None):
)
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.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 self.supports_apt():
await self.pre_curthooks_oem_configuration(context=context)

await run_curtin_step(
name="curthooks",
Expand Down

0 comments on commit 63dbc2d

Please sign in to comment.