|
|
|
@ -41,7 +41,7 @@ class partition(CryptoBoxPlugin.CryptoBoxPlugin):
|
|
|
|
|
pass
|
|
|
|
|
## no (or invalid) device was supplied
|
|
|
|
|
if not self.device:
|
|
|
|
|
step == "select_device"
|
|
|
|
|
step = "select_device"
|
|
|
|
|
if step == "add_partition":
|
|
|
|
|
return self.__actionAddPartition(args)
|
|
|
|
|
elif step == "del_partition":
|
|
|
|
@ -230,7 +230,6 @@ class partition(CryptoBoxPlugin.CryptoBoxPlugin):
|
|
|
|
|
self.hdf[self.hdf_prefix + "Types.%s" % t] = t
|
|
|
|
|
## store the currently existing partitions of the choosen block device
|
|
|
|
|
current_containers = [ e for e in self.cbox.getContainerList() if CryptoBoxTools.isPartOfBlockDevice(self.device, e.getDevice()) ]
|
|
|
|
|
## additionally store the uuids (to be removed after partitioning)
|
|
|
|
|
for (index, t) in enumerate(current_containers):
|
|
|
|
|
self.hdf[self.hdf_prefix + "ExistingContainers.%d.name" % index] = t.getName()
|
|
|
|
|
self.hdf[self.hdf_prefix + "ExistingContainers.%d.size" % index] = CryptoBoxTools.getBlockDeviceSizeHumanly(t.getDevice())
|
|
|
|
@ -373,7 +372,8 @@ class partition(CryptoBoxPlugin.CryptoBoxPlugin):
|
|
|
|
|
|
|
|
|
|
def __formatOnePartition(self, dev_name, type):
|
|
|
|
|
## first: retrieve UUID - it can be removed from the database afterwards
|
|
|
|
|
prev_uuid = [self.cbox.getUUIDForName(e.getName()) for e in self.cbox.getContainerList() if e.getDevice() == dev_name ]
|
|
|
|
|
volDB = self.cbox.prefs.volumesDB
|
|
|
|
|
prev_name = [e.getName() for e in self.cbox.getContainerList() if e.getDevice() == dev_name]
|
|
|
|
|
## call "mkfs"
|
|
|
|
|
proc = subprocess.Popen(
|
|
|
|
|
shell = False,
|
|
|
|
@ -390,9 +390,9 @@ class partition(CryptoBoxPlugin.CryptoBoxPlugin):
|
|
|
|
|
self.cbox.log.warn("failed to create filesystem on %s: %s" % (dev_name, error))
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
|
## remove unused uuid
|
|
|
|
|
if prev_uuid:
|
|
|
|
|
self.cbox.removeUUID(prev_uuid[0])
|
|
|
|
|
## remove unused volume entry
|
|
|
|
|
if prev_name:
|
|
|
|
|
self.cbox.prefs.volumesDB[prev_name[0]]
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|