diff options
author | Papoteur <papoteur@mageialinux-online.org> | 2015-10-08 22:32:37 +0200 |
---|---|---|
committer | Papoteur <papoteur@mageialinux-online.org> | 2015-10-08 22:32:37 +0200 |
commit | ebb2d8e4f763dfaac8b2c13ca0fce5880ed4f3d8 (patch) | |
tree | 611615a541ce12fc83396a5297c05cbfbdb961d0 | |
parent | 8ea718ffcc274502c7e0d7f60ee1b6477f153a9a (diff) | |
download | isodumper-ebb2d8e4f763dfaac8b2c13ca0fce5880ed4f3d8.tar isodumper-ebb2d8e4f763dfaac8b2c13ca0fce5880ed4f3d8.tar.gz isodumper-ebb2d8e4f763dfaac8b2c13ca0fce5880ed4f3d8.tar.bz2 isodumper-ebb2d8e4f763dfaac8b2c13ca0fce5880ed4f3d8.tar.xz isodumper-ebb2d8e4f763dfaac8b2c13ca0fce5880ed4f3d8.zip |
Better management of device busy
-rw-r--r-- | lib/isodumper.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index 6dd3647..23a84d2 100644 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -155,11 +155,6 @@ class UDisks2(object): list.append(item) return list - def unmount(self, device_node_path): - d = self.device(device_node_path) - d.Unmount({'force':False, 'auth.no_user_interaction':True}, - dbus_interface=self.FILESYSTEM) - def drive_for_device(self, device): drive = device.Get(self.BLOCK, 'Drive', dbus_interface='org.freedesktop.DBus.Properties') @@ -338,14 +333,17 @@ class IsoDumper(object): self.ima.setDisabled() self.writebt.setDisabled() self.do_umount(target) - # Writing step - #Dump mode - self.returncode=0 - b=os.path.getsize(source) - self.raw_write(source, target, b) - self.check_write(target, b) - if self.returncode == 0: - self.success() + if self.returncode != 1: + # Writing step + #Dump mode + self.returncode=0 + b=os.path.getsize(source) + self.raw_write(source, target, b) + self.check_write(target, b) + if self.returncode == 0: + self.success() + else: + self.restore() else: self.restore() def do_umount(self, target): @@ -355,16 +353,18 @@ class IsoDumper(object): for mount in mounts: self.logger(_('Trying to unmount ')+mount[0]+'...') try: - #retcode = call('umount '+mount[0], shell=True) - retcode = self.u.unmount(mount[0]) - if retcode < 0: + retcode = call('umount '+mount[0], shell=True) + if retcode == 32: + message = _('Partition %s is busy')%mount[0] + self.logger(message) + self.emergency(message) + elif retcode< 0: message = _('Error, umount ')+mount[0]+_(' was terminated by signal ')+str(retcode) self.logger(message) self.emergency(message) - else: - if retcode == 0: + elif retcode == 0: self.logger(mount[0]+_(' successfully unmounted')) - else: + else: message = _('Error, umount ')+mount[0]+_(' returned ')+str(retcode) self.logger(message) self.emergency(message) @@ -396,7 +396,7 @@ class IsoDumper(object): try: ofc= io.open(target, 'wb',0) except: - message = _('You have not the rights for writing on the device') + message = _('You have not the rights for writing on the device') +" "+ target self.logger(message) self.emergency(message) self.close() |