chroot/abstract: initialize(): if nothing is mounted at /, bind-mount over itself

This commit is contained in:
InsanePrawn 2023-01-06 05:51:34 +01:00
parent 9c77e2ffe3
commit 9e1348cbce

View file

@ -123,7 +123,11 @@ class Chroot(AbstractChroot):
active_previously = self.active active_previously = self.active
self.deactivate(fail_if_inactive=False, ignore_rootfs=True) self.deactivate(fail_if_inactive=False, ignore_rootfs=True)
if not (os.path.ismount(self.path) or check_findmnt(self.path)):
makedir(os.path.dirname(self.path))
root_makedir(self.path)
logging.debug(f"Bind-mounting {self.name} ({self.uuid}) over itself") # needed for pacman space calculation
self.mount(self.path, '/', options=['rbind'])
self.create_rootfs(reset, pacman_conf_target, active_previously) self.create_rootfs(reset, pacman_conf_target, active_previously)
def get_path(self, *joins: str) -> str: def get_path(self, *joins: str) -> str: