Chroot.activate(): actually do the mounting

This commit is contained in:
InsanePrawn 2021-10-19 06:54:45 +02:00
parent c5183bd0bf
commit 91cec7fabd

View file

@ -46,8 +46,10 @@ BASIC_MOUNTS = {
'options': ['mode=1777,nosuid,nodev'], 'options': ['mode=1777,nosuid,nodev'],
}, },
'/run': { '/run': {
'src': '/run' 'src': '/run',
} 'type': 'tmpfs',
'options': ['bind'],
},
} }
Chroot = None Chroot = None
@ -260,8 +262,14 @@ class Chroot:
return return
if not self.initialised: if not self.initialised:
self.init(fail_if_active=False) self.init(fail_if_active=False)
for dst, opts in BASIC_MOUNTS.items():
self.mount(
opts['src'],
dst,
fs_type=opts['type'],
options=opts['options']
)
self.active = True self.active = True
raise NotImplementedError('TODO: implement mounting /dev, /proc and /sys')
def deactivate(self, fail_if_inactive: bool = False): def deactivate(self, fail_if_inactive: bool = False):
if not self.active: if not self.active: