generalize live system package install
Add live_packages model method where install models may specify packages needed in the live system. Move efibootmgr there.
This commit is contained in:
parent
ff990df628
commit
aa27b33820
|
@ -2038,3 +2038,9 @@ class FilesystemModel(object):
|
||||||
)
|
)
|
||||||
self._actions.append(zpool)
|
self._actions.append(zpool)
|
||||||
return zpool
|
return zpool
|
||||||
|
|
||||||
|
async def live_packages(self):
|
||||||
|
r = []
|
||||||
|
if self.reset_partition is not None:
|
||||||
|
r.append("efibootmgr")
|
||||||
|
return r
|
||||||
|
|
|
@ -390,6 +390,14 @@ class SubiquityModel:
|
||||||
packages.extend(await meth())
|
packages.extend(await meth())
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
|
async def live_packages(self):
|
||||||
|
packages = []
|
||||||
|
for model_name in self._install_model_names.all():
|
||||||
|
meth = getattr(getattr(self, model_name), "live_packages", None)
|
||||||
|
if meth is not None:
|
||||||
|
packages.extend(await meth())
|
||||||
|
return packages
|
||||||
|
|
||||||
def _cloud_init_files(self):
|
def _cloud_init_files(self):
|
||||||
# TODO, this should be moved to the in-target cloud-config seed so on
|
# TODO, this should be moved to the in-target cloud-config seed so on
|
||||||
# first boot of the target, it reconfigures datasource_list to none
|
# first boot of the target, it reconfigures datasource_list to none
|
||||||
|
|
|
@ -597,6 +597,11 @@ class InstallController(SubiquityController):
|
||||||
with open(self.tpath("etc/fstab"), "w") as fp:
|
with open(self.tpath("etc/fstab"), "w") as fp:
|
||||||
fp.write("/run/mnt/ubuntu-boot/EFI/ubuntu /boot/grub none bind\n")
|
fp.write("/run/mnt/ubuntu-boot/EFI/ubuntu /boot/grub none bind\n")
|
||||||
|
|
||||||
|
@with_context(description="installing packages to live system")
|
||||||
|
async def install_live_packages(self, *, context):
|
||||||
|
for package in await self.model.live_packages():
|
||||||
|
await self.app.package_installer.install_pkg(package)
|
||||||
|
|
||||||
@with_context()
|
@with_context()
|
||||||
async def install(self, *, context):
|
async def install(self, *, context):
|
||||||
context.set("is-install-context", True)
|
context.set("is-install-context", True)
|
||||||
|
@ -627,8 +632,7 @@ class InstallController(SubiquityController):
|
||||||
fsc = self.app.controllers.Filesystem
|
fsc = self.app.controllers.Filesystem
|
||||||
for_install_path = self.model.source.get_source(fsc._info.name)
|
for_install_path = self.model.source.get_source(fsc._info.name)
|
||||||
|
|
||||||
if self.app.base_model.filesystem.reset_partition:
|
await self.install_live_packages()
|
||||||
self.app.package_installer.start_installing_pkg("efibootmgr")
|
|
||||||
|
|
||||||
if self.model.target is not None:
|
if self.model.target is not None:
|
||||||
if os.path.exists(self.model.target):
|
if os.path.exists(self.model.target):
|
||||||
|
|
Loading…
Reference in New Issue