summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2015-03-04 12:05:25 +0000
committerintrigeri <intrigeri@boum.org>2015-03-04 12:05:25 +0000
commit8a7c59152d0e12e78e082e924dd7307efa375780 (patch)
treee903f2f80cc1f46eb05d048b3b6d4c355e94cfb5
parent681e0a7698290ba583fc8652a87f08b3e8ceb97f (diff)
parent6f528f8fe16930fdb1adac1918cd3862899a4ae9 (diff)
Merge remote-tracking branch 'kurono/bugfix/6538-Tails-Installer-tries-to-install-to-too-small-devices'bugfix/8691-and-6538
Fix-committed: #6538
-rw-r--r--liveusb/config.py2
-rwxr-xr-xliveusb/creator.py14
2 files changed, 13 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 baa8dd4..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
@@ -676,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,