[Pkg-privacy-commits] [tails-installer] 07/07: Check if the used drive is not open in any application

Intrigeri intrigeri at moszumanska.debian.org
Wed May 24 15:27:45 UTC 2017


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to tag 3.93.2
in repository tails-installer.

commit 3230f33fdba60aab94808cd461254206635e1f6f
Author: Martin Briza <mbriza at redhat.com>
Date:   Fri Apr 22 18:16:28 2016 +0200

    Check if the used drive is not open in any application
---
 liveusb/creator.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/liveusb/creator.py b/liveusb/creator.py
index af936b7..d8cf0c7 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -379,8 +379,10 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         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 = subprocess.Popen(['umount', dev], env=env, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
                 umount.wait()
+                if not 'not mounted' in umount.stdout.readline():
+                    raise LiveUSBError(_("The drive you're trying to use is open in another application"))
 
         self.log.debug(_('Running'), cmd)
         dd = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=0, universal_newlines=True)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list