Removed unnecessary "--batch-mode" arguments to cryptsetup; fixed sizing issue with config partition

(cryptsetup is supposed to ignore "--batch-mode" unless given the "luksFormat" command,
but there have been problems with it in the past, for example with "isLuks".)
This commit is contained in:
frisco 2009-06-28 00:53:52 +00:00
parent cccc883b49
commit bbefb316f4
3 changed files with 12 additions and 12 deletions

View file

@ -36,8 +36,10 @@ PARTTYPES = {
"windows" : ["0xC", "vfat"], "windows" : ["0xC", "vfat"],
"linux" : ["L", "ext3"]} "linux" : ["L", "ext3"]}
##The configuration partition should be greater than the
##MINIMUM_STORAGE_SIZE to avoid problems, given sfdisk's size rounding.
CONFIGPARTITION = { CONFIGPARTITION = {
"size" : 5, # size of configuration partition (if necessary) in MB "size" : 12, ## size of configuration partition (if necessary) in MB
"type" : "L", "type" : "L",
"fs" : "ext2"} "fs" : "ext2"}
@ -365,7 +367,7 @@ class partition(cryptobox.plugins.base.CryptoBoxPlugin):
if int(size) > avail_size: if int(size) > avail_size:
self.hdf["Data.Warning"] = "Plugins.partition.PartitionTooBig" self.hdf["Data.Warning"] = "Plugins.partition.PartitionTooBig"
continue continue
if int(size) < 10: if int(size) < blockdevice_tools.MINIMUM_STORAGE_SIZE:
self.hdf["Data.Warning"] = "Plugins.partition.PartitionTooSmall" self.hdf["Data.Warning"] = "Plugins.partition.PartitionTooSmall"
continue continue
if not part_type in PARTTYPES.keys(): if not part_type in PARTTYPES.keys():

View file

@ -58,6 +58,9 @@ def __rereadPartitions(device):
return proc.returncode == 0 return proc.returncode == 0
def __formatPartition(device, type): def __formatPartition(device, type):
##TODO: This function is *probably* no longer used, since
##the user "cryptobox" is now a member of group "disk", but
##now (right before a release) is not the best time to remove it.
import time, threading import time, threading
result = True result = True
def formatting(): def formatting():

View file

@ -284,8 +284,7 @@ class CryptoBoxContainer:
self.cbox.prefs["Programs"]["CryptoBoxRootActions"], self.cbox.prefs["Programs"]["CryptoBoxRootActions"],
"program", "cryptsetup", "program", "cryptsetup",
"luksAddKey", "luksAddKey",
self.get_device(), self.get_device()])
"--batch-mode"])
proc.stdin.write("%s\n%s" % (oldpw, newpw)) proc.stdin.write("%s\n%s" % (oldpw, newpw))
(output, errout) = proc.communicate() (output, errout) = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0:
@ -311,8 +310,7 @@ class CryptoBoxContainer:
"program", "cryptsetup", "program", "cryptsetup",
"luksDelKey", "luksDelKey",
self.get_device(), self.get_device(),
"%d" % (keyslot, ), "%d" % (keyslot, )])
"--batch-mode"])
proc.wait() proc.wait()
if proc.returncode != 0: if proc.returncode != 0:
error_msg = "Could not remove the old luks key: %s" % (proc.stderr.read().strip(), ) error_msg = "Could not remove the old luks key: %s" % (proc.stderr.read().strip(), )
@ -454,8 +452,7 @@ class CryptoBoxContainer:
"program", "cryptsetup", "program", "cryptsetup",
"luksOpen", "luksOpen",
self.get_device(), self.get_device(),
self.name, self.name])
"--batch-mode"])
proc.stdin.write(password) proc.stdin.write(password)
(output, errout) = proc.communicate() (output, errout) = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0:
@ -536,8 +533,7 @@ class CryptoBoxContainer:
self.cbox.prefs["Programs"]["CryptoBoxRootActions"], self.cbox.prefs["Programs"]["CryptoBoxRootActions"],
"program", "cryptsetup", "program", "cryptsetup",
"luksClose", "luksClose",
self.name, self.name])
"--batch-mode"])
proc.wait() proc.wait()
if proc.returncode != 0: if proc.returncode != 0:
err_msg = "Could not remove the luks mapping: %s" % (proc.stderr.read().strip(), ) err_msg = "Could not remove the luks mapping: %s" % (proc.stderr.read().strip(), )
@ -705,8 +701,7 @@ class CryptoBoxContainer:
"program", "cryptsetup", "program", "cryptsetup",
"luksOpen", "luksOpen",
self.get_device(), self.get_device(),
self.name, self.name])
"--batch-mode"])
proc.stdin.write(password) proc.stdin.write(password)
(output, errout) = proc.communicate() (output, errout) = proc.communicate()
if proc.returncode != 0: if proc.returncode != 0: