* filesystem determination works with encrypted containers

This commit is contained in:
age 2007-08-12 09:35:26 +00:00
parent 746bc1bb3e
commit 56584aef69

View file

@ -453,18 +453,26 @@ class CryptoBoxContainer:
def __get_fs_type(self): def __get_fs_type(self):
"returns the filesystem used on a container" "returns the filesystem used on a container"
#TODO: with a luks volume use the mapping instead of the device ## should we handle device mapping or plain device
if self.__is_luks_partition() and self.name:
container = os.path.join(self.__dmDir, self.name)
## can't determine fs while encrypted
if not self.is_mounted():
return "unavailable"
else:
container = self.device
proc = subprocess.Popen( proc = subprocess.Popen(
shell = False, shell = False,
stdout = subprocess.PIPE, stdout = subprocess.PIPE,
stderr = subprocess.PIPE, stderr = subprocess.PIPE,
args = [ self.cbox.prefs["Programs"]["blkid"], args = [ self.cbox.prefs["Programs"]["blkid"],
"-s","TYPE", "-s","TYPE",
self.device ]) container ])
(stdout, stderr) = proc.communicate() (stdout, stderr) = proc.communicate()
if proc.returncode == 0: if proc.returncode == 0:
return stdout.split("TYPE=")[1] return stdout.split("TYPE=")[1]
else: else:
## if something goes wrong don't dig deeper
self.cbox.log.warn("filesystem determination failed: %s" % \ self.cbox.log.warn("filesystem determination failed: %s" % \
(stderr.strip(), )) (stderr.strip(), ))
return "undetermined" return "undetermined"