Improved logging, and made MapperDev() representable
This commit is contained in:
parent
c2d765ff6d
commit
f2750c8d21
|
|
@ -16,6 +16,9 @@ if TYPE_CHECKING:
|
|||
class MapperDev:
|
||||
mappername :str
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return self.path
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.mappername
|
||||
|
|
|
|||
|
|
@ -102,8 +102,8 @@ class luks2:
|
|||
'luksFormat', partition.path,
|
||||
])
|
||||
|
||||
print(f"Looking for phrase: 'Enter passphrase for {partition.path}'")
|
||||
cryptworker = SysCommandWorker(cryptsetup_args, peak_output=True)
|
||||
print(f" Looking for phrase: 'Enter passphrase for {partition.path}'")
|
||||
|
||||
pw_given = False
|
||||
while cryptworker.is_alive():
|
||||
|
|
@ -193,9 +193,11 @@ class luks2:
|
|||
raise DiskError(f"Could not unlock {partition}: {cryptworker}")
|
||||
|
||||
if os.path.islink(f'/dev/mapper/{mountpoint}'):
|
||||
self.mapdev = f'/dev/mapper/{mountpoint}'
|
||||
self.mapdev = MapperDev(mountpoint)
|
||||
|
||||
return MapperDev(mountpoint)
|
||||
log(f"{partition} unlocked as {self.mapdev}")
|
||||
|
||||
return self.mapdev
|
||||
|
||||
def close(self, mountpoint :Optional[str] = None) -> bool:
|
||||
if not mountpoint:
|
||||
|
|
|
|||
Loading…
Reference in New Issue