mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-09 21:05:24 +01:00
Add an option to avoid creating a tmpfs in prepare()
Root access is required for creating tmpfs mounts in the context of the current mount namespace, and creating a tmpfs in the context of a new mount namespace is less useful because a process in the parent namespace can't easily access it. So add an option to avoid creating tmpfs mounts, which will be used by the rootless bootstrap mode for now. In addition, when tmp directories aren't mounted as tmpfs, their contents can't be removed using os.umount(). So instead remove them recursively using shutil.rmtree().
This commit is contained in:
parent
6d357226a9
commit
8330ab4504
4 changed files with 44 additions and 18 deletions
9
sysc.py
9
sysc.py
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
"""System C"""
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
|
|
@ -31,7 +32,6 @@ class SysC(SysGeneral):
|
|||
self.tmp_dir = os.path.join(self.sys_dir, 'tmp')
|
||||
else:
|
||||
self.tmp_dir = os.path.join(tmpdir, 'sysc')
|
||||
os.mkdir(self.tmp_dir)
|
||||
|
||||
def __del__(self):
|
||||
if not self.preserve_tmp:
|
||||
|
|
@ -41,11 +41,14 @@ class SysC(SysGeneral):
|
|||
|
||||
super().__del__()
|
||||
|
||||
def prepare(self, create_disk_image):
|
||||
def prepare(self, mount_tmpfs, create_disk_image):
|
||||
"""
|
||||
Prepare directory structure for System C.
|
||||
"""
|
||||
self.mount_tmpfs()
|
||||
if mount_tmpfs:
|
||||
self.mount_tmpfs()
|
||||
else:
|
||||
os.mkdir(self.tmp_dir)
|
||||
|
||||
rootfs_dir = None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue