copy /cdrom to the reset partition, if configured
This commit is contained in:
parent
c9be41c227
commit
e59e4e7c7a
|
@ -51,6 +51,9 @@ from subiquity.server.curtin import (
|
|||
run_curtin_command,
|
||||
start_curtin_command,
|
||||
)
|
||||
from subiquity.server.mounter import (
|
||||
Mounter,
|
||||
)
|
||||
from subiquity.server.types import (
|
||||
InstallerChannels,
|
||||
)
|
||||
|
@ -147,6 +150,16 @@ class InstallController(SubiquityController):
|
|||
config.update(kw)
|
||||
return config
|
||||
|
||||
def rp_config(self, logs_dir: Path, target: str) -> Dict[str, Any]:
|
||||
"""Return configuration to be used as part of populating a recovery
|
||||
partition."""
|
||||
return {
|
||||
"install": {
|
||||
"target": target,
|
||||
"resume_data": None,
|
||||
}
|
||||
}
|
||||
|
||||
@with_context(description="umounting /target dir")
|
||||
async def unmount_target(self, *, context, target):
|
||||
await run_curtin_command(self.app, context, 'unmount', '-t', target,
|
||||
|
@ -224,7 +237,7 @@ class InstallController(SubiquityController):
|
|||
|
||||
fs_controller = self.app.controllers.Filesystem
|
||||
|
||||
async def run_curtin_step(name, stages, step_config):
|
||||
async def run_curtin_step(name, stages, step_config, source=source):
|
||||
config = copy.deepcopy(base_config)
|
||||
merge_config(config, copy.deepcopy(step_config))
|
||||
await self.run_curtin_step(
|
||||
|
@ -291,6 +304,15 @@ class InstallController(SubiquityController):
|
|||
# really write recovery_system={snapd_system_label} to
|
||||
# {target}/var/lib/snapd/modeenv to get snapd to pick it up on
|
||||
# first boot. But not needed for now.
|
||||
rp = fs_controller.reset_partition
|
||||
if rp is not None:
|
||||
mounter = Mounter(self.app)
|
||||
async with mounter.mounted(rp.path) as mp:
|
||||
await run_curtin_step(
|
||||
name="populate recovery", stages=["extract"],
|
||||
step_config=self.rp_config(logs_dir, mp.p()),
|
||||
source='cp:///cdrom',
|
||||
)
|
||||
|
||||
@with_context(description="creating fstab")
|
||||
async def create_core_boot_classic_fstab(self, *, context):
|
||||
|
|
Loading…
Reference in New Issue