logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>
commit: 537cdb6540e5edcdbbf59a3c243c1444cc9c0a4c
parent 8c605f213a9c015886dc3923ee7131f50cd554cb
Author: Dor Askayo <dor.askayo@gmail.com>
Date:   Mon, 23 May 2022 14:45:59 +0300

Detach loopback device only if it was attached

Also change the print to better describe the action taken.

Diffstat:

Msysc.py7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sysc.py b/sysc.py @@ -16,6 +16,9 @@ class SysC(SysGeneral): """ Class responsible for preparing sources for System C. """ + + dev_name = None + # pylint: disable=too-many-instance-attributes def __init__(self, arch, preserve_tmp, tmpdir, chroot): self.git_dir = os.path.dirname(os.path.join(__file__)) @@ -35,8 +38,8 @@ class SysC(SysGeneral): def __del__(self): if not self.preserve_tmp: - if not self.chroot: - print(f"Deleting {self.dev_name}") + if self.dev_name is not None: + print(f"Detaching {self.dev_name}") run('sudo', 'losetup', '-d', self.dev_name) super().__del__()