[Tails-dev] [review'n'merge:1.2.2] bugfix/6538-Tails-Install…

Delete this message

Reply to this message
Autore: kurono
Data:  
To: tails-dev
Oggetto: [Tails-dev] [review'n'merge:1.2.2] bugfix/6538-Tails-Installer-tries-to-install-to-too-small-devices
Hi,

Ticket: https://labs.riseup.net/code/issues/6538

I am sending a patch again, since I could not access the repo (It does
not recognize my public key, maybe its my fault :/). Besides, I am not
sure about the smallest required size for the USB stick, I wrote a
kind of arbitrary size:

+    'min_device_size': 2.8,


based on the ticket and this document:
https://tails.boum.org/contribute/design/installation/
Any feedback is very welcome.

Cheers,

kurono
>From c9bc0857003e997a1cc31bb3753e3908d880f77d Mon Sep 17 00:00:00 2001
From: Tails developers <tails@???>
Date: Tue, 9 Dec 2014 20:44:48 +0100
Subject: [PATCH]
bugfix/6538-Tails-Installer-tries-to-install-to-too-small-devices

---
liveusb/config.py | 1 +
liveusb/creator.py | 5 +++++
2 files changed, 6 insertions(+)

diff --git a/liveusb/config.py b/liveusb/config.py
index e3e1b40..cd60f20 100644
--- a/liveusb/config.py
+++ b/liveusb/config.py
@@ -9,6 +9,7 @@ config_files = [ os.path.join('/', 'etc', 'liveusb-creator', f )

 # XXX: move defaults to a proper defaults.ini file?
 default_config = {
+    'min_device_size': 2.8,
     '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 20981d6..c9c0c34 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -674,6 +674,11 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
                     self.log.debug('Skipping device without size: %s' % device)
                     continue


+                # Skip devices that are too small
+                if (data['size']/10.0**9) < config['min_device_size']:
+                    self.log.warning('Skipping too small device: %s' % device)
+                    continue
+
                 parent = dev.Get(device, 'PartitionSlave')
                 if parent and parent != '/':
                     data['parent'] = str(dbus.Interface(self._get_device(parent),
-- 
1.8.3.2