From 513b313a4db10c4fba28023a5fa5657ad826b042 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Wed, 18 Nov 2020 22:30:01 +0100 Subject: Add more details about operation --- backend/raw_write.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'backend') diff --git a/backend/raw_write.py b/backend/raw_write.py index 8338a07..0ea3bcc 100755 --- a/backend/raw_write.py +++ b/backend/raw_write.py @@ -246,16 +246,17 @@ class Dumper(object): if rc != 0: self.return_state = False self.return_message = _("Error while doing persistent partition: ") + errs.decode('utf-8') + logging.error(self.return_message) return logging.debug("New partition created") - self._progress = 33 + self._progress = 25 # Wait for propagation of the info of new partition table if not self.udev_wait("creating a new partition table"): return - self._progress = 50 if key == "": # example mkfs.ext4 -L mgalive-persist /dev/sdf3 + self.return_message = _("Persistent partition added. Formatting...") process = Popen(['mkfs.ext4', "-q",'-F','-L', label, target+"3"],stderr=PIPE) outs, errs = process.communicate() working=True @@ -282,7 +283,7 @@ class Dumper(object): return else: # example cryptsetup luksFormat /dev/sdb3 - print("Crypt key provided",file=sys.stderr) + self.return_message = _("Persistent partition added. Encrypting...") base_target = os.path.basename(target) + "3" process = Popen(['cryptsetup','luksFormat','-q', target+"3", '-d', '-'],stdin=PIPE, stderr=PIPE) outs, errs = process.communicate(input=key.encode('utf-8')) @@ -302,7 +303,8 @@ class Dumper(object): logging.error(self.return_message) self.finished.set() return - self._progress = 75 + self._progress = 50 + self.return_message = _("Persistent partition encrypted. Opening...") # cryptsetup open /dev/sdb3 crypt_sdb3 if not self.udev_wait("creating encrypted partition"): return @@ -328,6 +330,8 @@ class Dumper(object): if not self.udev_wait(_("opening encrypted partition")): return + self._progress = 60 + self.return_message = _("Persistent partition opened: formatting...") # mkfs.ext4 -L mgalive-persist /dev/mapper/crypt_sdb3 process = Popen(['mkfs.ext4','-q','-F','-L', label, '/dev/mapper/crypt_' + base_target],stderr=PIPE) outs, errs = process.communicate() @@ -347,6 +351,7 @@ class Dumper(object): logging.error(self.return_message) self.finished.set() return + self._progress = 90 # cryptsetup close crypt_sdb3 if not self.udev_wait(_("formatting encrypted partition")): @@ -370,7 +375,7 @@ class Dumper(object): else: self.return_state = True self.return_message = _("Persistent partition done") - logging.info("Persistent partition done") + logging.info(self.return_message) if not self.udev_wait(_("closing encrypted partition")): return self._progress = 100 -- cgit v1.2.1