parent
8857f53cd1
commit
a8a9056f1d
|
@ -33,7 +33,7 @@ class SysGeneral:
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if not self.preserve_tmp:
|
if not self.preserve_tmp:
|
||||||
print("Unmounting tmpfs from %s" % (self.tmp_dir))
|
print(f"Unmounting tmpfs from {self.tmp_dir}")
|
||||||
umount(self.tmp_dir)
|
umount(self.tmp_dir)
|
||||||
os.rmdir(self.tmp_dir)
|
os.rmdir(self.tmp_dir)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class SysGeneral:
|
||||||
"""Mount the tmpfs for this sysx"""
|
"""Mount the tmpfs for this sysx"""
|
||||||
if not os.path.isdir(self.tmp_dir):
|
if not os.path.isdir(self.tmp_dir):
|
||||||
os.mkdir(self.tmp_dir)
|
os.mkdir(self.tmp_dir)
|
||||||
print("Mounting tmpfs on %s" % (self.tmp_dir))
|
print(f"Mounting tmpfs on {self.tmp_dir}")
|
||||||
mount('tmpfs', self.tmp_dir, 'tmpfs', 'size=8G')
|
mount('tmpfs', self.tmp_dir, 'tmpfs', 'size=8G')
|
||||||
|
|
||||||
def check_file(self, file_name):
|
def check_file(self, file_name):
|
||||||
|
@ -80,7 +80,7 @@ class SysGeneral:
|
||||||
|
|
||||||
# Actually download the file
|
# Actually download the file
|
||||||
if not os.path.isfile(abs_file_name):
|
if not os.path.isfile(abs_file_name):
|
||||||
print("Downloading: %s" % (file_name))
|
print(f"Downloading: {file_name}")
|
||||||
request = requests.get(url, allow_redirects=True)
|
request = requests.get(url, allow_redirects=True)
|
||||||
# pylint: disable=consider-using-with
|
# pylint: disable=consider-using-with
|
||||||
open(abs_file_name, 'wb').write(request.content)
|
open(abs_file_name, 'wb').write(request.content)
|
||||||
|
|
|
@ -81,7 +81,7 @@ def main():
|
||||||
|
|
||||||
def bootstrap(args, system_a, system_b, system_c):
|
def bootstrap(args, system_a, system_b, system_c):
|
||||||
"""Kick off bootstrap process."""
|
"""Kick off bootstrap process."""
|
||||||
print("Bootstrapping %s -- SysA" % (args.arch))
|
print(f"Bootstrapping {args.arch} -- SysA")
|
||||||
if args.chroot:
|
if args.chroot:
|
||||||
find_chroot = """
|
find_chroot = """
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -97,7 +97,7 @@ print(shutil.which('chroot'))
|
||||||
# We skip sysb as that is only pertinent to "hardware" (not chroot)
|
# We skip sysb as that is only pertinent to "hardware" (not chroot)
|
||||||
system_c.chroot_transition(system_a.tmp_dir)
|
system_c.chroot_transition(system_a.tmp_dir)
|
||||||
# sysc
|
# sysc
|
||||||
print("Bootstrapping %s -- SysC" % (args.arch))
|
print(f"Bootstrapping {args.arch} -- SysC")
|
||||||
init = os.path.join(os.sep, 'init')
|
init = os.path.join(os.sep, 'init')
|
||||||
run('sudo', chroot_binary, system_c.tmp_dir, init)
|
run('sudo', chroot_binary, system_c.tmp_dir, init)
|
||||||
|
|
||||||
|
|
4
sysc.py
4
sysc.py
|
@ -35,9 +35,9 @@ class SysC(SysGeneral):
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if not self.preserve_tmp:
|
if not self.preserve_tmp:
|
||||||
if not self.chroot:
|
if not self.chroot:
|
||||||
print("Deleting %s" % (self.dev_name))
|
print(f"Deleting {self.dev_name}")
|
||||||
run('sudo', 'losetup', '-d', self.dev_name)
|
run('sudo', 'losetup', '-d', self.dev_name)
|
||||||
print("Unmounting tmpfs from %s" % (self.tmp_dir))
|
print(f"Unmounting tmpfs from {self.tmp_dir}")
|
||||||
umount(self.tmp_dir)
|
umount(self.tmp_dir)
|
||||||
os.rmdir(self.tmp_dir)
|
os.rmdir(self.tmp_dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue