Skip to content

Commit

Permalink
Merge pull request #1431 from mwhudson/cleaner-cdrom-cleanup
Browse files Browse the repository at this point in the history
remove special cases around mounting/unmounting /target/cdrom
  • Loading branch information
mwhudson authored Oct 5, 2022
2 parents cc33a66 + 9f32abd commit f5dd2ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions subiquity/server/apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,6 @@ async def _restore_dir(dir):
'cp', '-aT', self.configured_tree.p(dir), target_mnt.p(dir),
])

await self.unmount(
Mountpoint(mountpoint=target_mnt.p('cdrom')),
remove=True)
os.rmdir(target_mnt.p('cdrom'))

await _restore_dir('etc/apt')

if self.app.base_model.network.has_network:
Expand All @@ -277,11 +272,14 @@ async def _restore_dir(dir):
await _restore_dir('var/lib/apt/lists')

await self.cleanup()
os.rmdir(target_mnt.p('cdrom'))

async def setup_target(self):
async def setup_target(self, context, target: str):
# Call this after the rootfs has been extracted to the real target
# system but before any configuration is applied to it.
await self.mount('/cdrom', '/target/cdrom', options='bind')
target_mnt = Mountpoint(mountpoint=target)
await self.mount(
'/cdrom', target_mnt.p('cdrom'), options='bind')


class DryRunAptConfigurer(AptConfigurer):
Expand Down
2 changes: 1 addition & 1 deletion subiquity/server/controllers/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async def configure_apt(self, *, context):

async def setup_target(self, context):
mirror = self.app.controllers.Mirror
await mirror.apt_configurer.setup_target()
await mirror.apt_configurer.setup_target(context, self.tpath())

@with_context(
description="installing system", level="INFO", childlevel="DEBUG")
Expand Down

0 comments on commit f5dd2ec

Please sign in to comment.