Make rootfs_dir local to prepare()
It's not needed by other methods.
This commit is contained in:
parent
537cdb6540
commit
7040b550a9
17
sysc.py
17
sysc.py
|
@ -49,26 +49,29 @@ class SysC(SysGeneral):
|
||||||
Prepare directory structure for System C.
|
Prepare directory structure for System C.
|
||||||
"""
|
"""
|
||||||
self.mount_tmpfs()
|
self.mount_tmpfs()
|
||||||
|
|
||||||
|
rootfs_dir = None
|
||||||
|
|
||||||
if not self.chroot:
|
if not self.chroot:
|
||||||
# Create + mount a disk for QEMU to use
|
# Create + mount a disk for QEMU to use
|
||||||
disk_path = os.path.join(self.tmp_dir, 'disk.img')
|
disk_path = os.path.join(self.tmp_dir, 'disk.img')
|
||||||
self.dev_name = create_disk(disk_path, "msdos", "ext4", '8G')
|
self.dev_name = create_disk(disk_path, "msdos", "ext4", '8G')
|
||||||
self.rootfs_dir = os.path.join(self.tmp_dir, 'mnt')
|
rootfs_dir = os.path.join(self.tmp_dir, 'mnt')
|
||||||
os.mkdir(self.rootfs_dir)
|
os.mkdir(rootfs_dir)
|
||||||
mount(self.dev_name + "p1", self.rootfs_dir, 'ext4')
|
mount(self.dev_name + "p1", rootfs_dir, 'ext4')
|
||||||
# Use chown to allow executing user to access it
|
# Use chown to allow executing user to access it
|
||||||
run('sudo', 'chown', getpass.getuser(), self.dev_name)
|
run('sudo', 'chown', getpass.getuser(), self.dev_name)
|
||||||
run('sudo', 'chown', getpass.getuser(), self.rootfs_dir)
|
run('sudo', 'chown', getpass.getuser(), rootfs_dir)
|
||||||
else:
|
else:
|
||||||
self.rootfs_dir = self.tmp_dir
|
rootfs_dir = self.tmp_dir
|
||||||
|
|
||||||
self.get_packages()
|
self.get_packages()
|
||||||
|
|
||||||
copytree(self.sys_dir, self.rootfs_dir, ignore=shutil.ignore_patterns("tmp"))
|
copytree(self.sys_dir, rootfs_dir, ignore=shutil.ignore_patterns("tmp"))
|
||||||
|
|
||||||
# Unmount tmp/mnt if it exists
|
# Unmount tmp/mnt if it exists
|
||||||
if not self.chroot:
|
if not self.chroot:
|
||||||
umount(self.rootfs_dir)
|
umount(rootfs_dir)
|
||||||
|
|
||||||
# pylint: disable=line-too-long,too-many-statements
|
# pylint: disable=line-too-long,too-many-statements
|
||||||
def get_packages(self):
|
def get_packages(self):
|
||||||
|
|
Loading…
Reference in New Issue