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

Borrar esta mensaxe

Responder a esta mensaxe
Autor: kurono
Data:  
Para: The Tails public development discussion list
Asunto: Re: [Tails-dev] [review'n'merge:1.2.2] bugfix/6538-Tails-Installer-tries-to-install-to-too-small-devices

Hi,

>> I am sending a patch again, since I could not access the repo (It
>> does not recognize my public key, maybe its my fault :/).
>
> I think you need to initialize it by pushing something to it once,
> before you can fetch from your repo.
>


No, I think thats not the problem, since I am not allowed to push
changes to the other repos as well. Maybe I am missing something.
I was able to do it before.

>> 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,

>
> Should be enough technically, but then the persistence partition
> would be tiny, and I've never heard of media suitable for Tails
> between 2 and 4 GB (exclusive) => 4 GB should be the lower limit,
> IMO (take the interpretation of "GB" that gives the smaller
> result).
>
> I've therefore marked this ticket as needs more dev. Soon there!
> :)


Ok done, I attached a new patch.

Cheers,

Kurono
>From 5f6fa3cba6409193f50c345fdad02ad360a5371c Mon Sep 17 00:00:00 2001
From: Tails developers <tails@???>
Date: Thu, 11 Dec 2014 20:06:16 +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..8854acf 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': 4.0,
     '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