aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbackend/raw_write.py13
-rwxr-xr-xlib/isodumper.py18
2 files changed, 22 insertions, 9 deletions
diff --git a/backend/raw_write.py b/backend/raw_write.py
index 0ea3bcc..b90fdd6 100755
--- a/backend/raw_write.py
+++ b/backend/raw_write.py
@@ -245,8 +245,9 @@ class Dumper(object):
working= False
if rc != 0:
self.return_state = False
- self.return_message = _("Error while doing persistent partition: ") + errs.decode('utf-8')
+ self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')
logging.error(self.return_message)
+ self.finished.set()
return
logging.debug("New partition created")
self._progress = 25
@@ -275,7 +276,7 @@ class Dumper(object):
self.return_message = _("Persistent partition done")
else:
self.return_state = False
- self.return_message = _("Error while doing persistent partition: ") + errs.decode("utf-8")
+ self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')
self.finished.set()
return
logging.info("Persistent partition done")
@@ -299,7 +300,7 @@ class Dumper(object):
working= False
if rc != 0:
self.return_state = False
- self.return_message = _("Error while doing persistent partition: ") + errs.decode("utf-8")
+ self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')
logging.error(self.return_message)
self.finished.set()
return
@@ -323,7 +324,7 @@ class Dumper(object):
working= False
if rc != 0:
self.return_state = False
- self.return_message = _("Error while doing persistent partition: ") + errs.decode("utf-8")
+ self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')
logging.error(self.return_message)
self.finished.set()
return
@@ -347,7 +348,7 @@ class Dumper(object):
working= False
if rc != 0:
self.return_state = False
- self.return_message = _("Error while doing persistent partition: ") + errs.decode("utf-8")
+ self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')
logging.error(self.return_message)
self.finished.set()
return
@@ -370,7 +371,7 @@ class Dumper(object):
working= False
if rc != 0:
self.return_state = False
- self.return_message = _("Error while doing persistent partition: ") + errs.decode("utf-8")
+ self.return_message = _("Error {} while doing persistent partition: {}").format(rc, errs.decode('utf-8')
logging.error(self.return_message)
else:
self.return_state = True
diff --git a/lib/isodumper.py b/lib/isodumper.py
index 51e85ff..e43fda5 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -28,6 +28,7 @@
# ensure we're using the latest build, if called from our build environment
import sys
import importlib
+import logging
try:
from isodumper import version
@@ -118,7 +119,6 @@ class UDisks2(object):
if objects[block['path']][self.SERVICE + '.Partition']['Table'].split('/')[-1] == target:
if (self.SERVICE + '.Encrypted' in objects[block['path']]): # Is the partition encrypted ?
path_to_encrypted = objects[block['path']][self.SERVICE + '.Encrypted']['CleartextDevice']
- print(path_to_encrypted)
if path_to_encrypted != '/':
iface = self.bus.get(self.SERVICE, path_to_encrypted)
fs = iface[self.SERVICE + '.Filesystem']
@@ -127,12 +127,16 @@ class UDisks2(object):
iface = self.bus.get(self.SERVICE, block['path'])
fs = iface[self.SERVICE + '.Encrypted']
fs.Lock({})
+ logging.debug(f"Unmounting encryted {block['path']}")
else:
iface = self.bus.get(self.SERVICE, block['path'])
if self.SERVICE + '.Filesystem' in objects[block['path']]:
fs = iface[self.SERVICE + '.Filesystem']
if fs.MountPoints: # partition is mounted
+ logging.debug(f"Unmounting {block['path']}")
fs.Unmount({})
+ else:
+ logging.debug(f"Not mounted {block['path']}")
return True, ""
def eject(self, device):
@@ -555,7 +559,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog
if self.ask_OK(info):
return
- def __init__(self):
+ def __init__(self, debug=False):
APP = "isodumper"
DIR = "/usr/share/locale"
# Call translation catalog
@@ -572,6 +576,10 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog
exit()
# TODO Read log level from command line
+ level = logging.DEBUG if debug else logging.ERROR
+ logging.basicConfig(filename=os.path.join(os.path.expanduser('~'), '.isodumper',"isodumper2.log"),
+ format='%(asctime)s %(levelname)-8s %(message)s',
+ level=level)
# define size of the selected device
self.deviceSize = 0
@@ -857,10 +865,14 @@ if __name__ == "__main__":
# Send the yui logging outside of the console
log = yui.YUILog.setLogFileName("/dev/null")
parser = ParseCLI('isodumper')
+ parser.parser.add_argument('--debug', help=_('allow debug information'), action='store_true')
if parser.args.version:
print(version.RELEASE)
else:
- app = IsoDumper()
+ if parser.args.debug:
+ app = IsoDumper(debug=True)
+ else:
+ app = IsoDumper()
app.run()
# next line seems to be a workaround to prevent the qt-app from crashing
# see https://github.com/libyui/libyui-qt/issues/41