summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Briza <mbriza@redhat.com>2016-04-21 17:49:05 +0200
committerMartin Briza <mbriza@redhat.com>2016-04-21 17:49:05 +0200
commitb7091fee9ee985e7ccbd8509a9ebf0607951b5b1 (patch)
tree236ed16122872d8448cd9d95a6aad9e43441bd00
parent5f7950061136db5c3ee68511d813b166d13f719f (diff)
Unmount the drive before writing in linux3.93.1
-rwxr-xr-xliveusb/creator.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/liveusb/creator.py b/liveusb/creator.py
index dfd35e4..0c14538 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -359,6 +359,12 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
if update_function:
update_function(0.0)
+ for i in os.listdir('/dev'):
+ dev = os.path.join('/dev/', i)
+ if dev.startswith(os.path.normpath(drive)) and dev != os.path.normpath(drive):
+ umount = subprocess.Popen(['umount', '-f', dev], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ umount.wait()
+
self.log.debug(_('Running'), cmd)
dd = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=0, universal_newlines=True)