summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2015-03-30 12:57:00 +0200
committeranonym <anonym@riseup.net>2015-03-30 12:57:00 +0200
commit19adca1eba434349143cd576a83a6f78df22ef04 (patch)
treee903f2f80cc1f46eb05d048b3b6d4c355e94cfb5
parent1ef04cec32064ea40f7fc56a15dea9b6b331fd93 (diff)
parent8a7c59152d0e12e78e082e924dd7307efa375780 (diff)
Merge remote-tracking branch 'origin/bugfix/8691-and-6538'
-rw-r--r--liveusb/config.py2
-rwxr-xr-xliveusb/creator.py15
2 files changed, 14 insertions, 3 deletions
diff --git a/liveusb/config.py b/liveusb/config.py
index e3e1b40..c706c7b 100644
--- a/liveusb/config.py
+++ b/liveusb/config.py
@@ -9,6 +9,8 @@ config_files = [ os.path.join('/', 'etc', 'liveusb-creator', f )
# XXX: move defaults to a proper defaults.ini file?
default_config = {
+ 'min_system_partition_size': 2500, # MiB
+ 'min_persistence_partition_size': 1000, # MiB
'main_liveos_dir': 'live',
'running_liveos_mountpoint': '/lib/live/mount/medium',
'liveos_toplevel_files': [ 'autorun.bat', 'autorun.inf', 'boot', '.disk',
diff --git a/liveusb/creator.py b/liveusb/creator.py
index 82721c3..00b8bc9 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -66,7 +66,8 @@ class LiveUSBError(Exception):
class LiveUSBCreator(object):
""" An OS-independent parent class for Live USB Creators """
- system_partition_size = 2500 # MiB
+ system_partition_size = config['min_system_partition_size'] # MiB
+ min_persistence_partition_size = config['min_persistence_partition_size'] # MiB
source = None # the object representing our live source image
label = config['branding']['partition_label'] # if one doesn't already exist
fstype = None # the format of our usb stick
@@ -277,8 +278,9 @@ class LiveUSBCreator(object):
'Y', # proceed, possibly destroying data
])
- def is_device_big_enough(self):
- if self.system_partition_size * 1024**2 <= self.drive['size']:
+ def is_device_big_enough(self, deviceSize):
+ if (self.system_partition_size + self.min_persistence_partition_size) \
+ * 1024**2 <= deviceSize:
return True
return False
@@ -632,6 +634,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
def handle_reply(devices):
# Map from device to a set of (currently mounted) partitions
mounted_parts = {}
+ self.drives = {}
for device in devices:
dev_obj = self.bus.get_object("org.freedesktop.UDisks", device)
dev = dbus.Interface(dev_obj, "org.freedesktop.DBus.Properties")
@@ -675,6 +678,12 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
continue
parent = dev.Get(device, 'PartitionSlave')
+ # Skip devices that are too small
+ if self.opts.partition and not (parent and parent != '/') \
+ and not self.is_device_big_enough(data['size']):
+ self.log.warning('Skipping too small device: %s' % device)
+ continue
+
if parent and parent != '/':
data['parent'] = str(dbus.Interface(self._get_device(parent),
'org.freedesktop.DBus.Properties').Get(parent,