Re: [Tails-dev] Persistence: display nicer paths

Supprimer ce message

Répondre à ce message
Auteur: Andres Gomez Ramirez
Date:  
À: The Tails public development discussion list
Sujet: Re: [Tails-dev] Persistence: display nicer paths
Hi,

Attached the second version, my comments:

>> +sub _build_partition_file {
>> +    my $self = shift;
>> +
>> +    my $device_file = $self->get_device_property($self->device, 'DeviceFile');
>> +    my $partition_number =
>>      $self->get_device_property($self->persistence_partition,
>>      'PartitionNumber');
>> +
>> +    $device_file.$partition_number;


> This naming scheme is not correct for all kinds of supported devices,
> e.g. SD cards plugged into a reader wired via SDIO. See commit
> 83637f4e for details. Doesn't $self->persistence_partition have
> a DeviceFile property that we could use instead of manually appending
> the partition number this way? If it has, let's simply use it. Else,
> using the info from commit 83637f4e should be good enough.


Ok in this version of tails-persistence was possible to use simply DeviceFilePresentation :)

Cheers,

Andres

From 66e863907f7ecb4e02823d3731cc6bd53eb8c7ed Mon Sep 17 00:00:00 2001
From: kurono <andres.gomez@???>
Date: Wed, 18 Dec 2013 23:10:04 +0100
Subject: [PATCH] persistence: display nicer paths

---
 lib/Tails/Persistence/Setup.pm          |    9 +++++++++
 lib/Tails/Persistence/Step/Configure.pm |    4 ++--
 lib/Tails/Persistence/Step/Delete.pm    |    5 +++--
 3 files changed, 14 insertions(+), 4 deletions(-)


diff --git a/lib/Tails/Persistence/Setup.pm b/lib/Tails/Persistence/Setup.pm
index 431e71a..1944737 100644
--- a/lib/Tails/Persistence/Setup.pm
+++ b/lib/Tails/Persistence/Setup.pm
@@ -102,6 +102,7 @@ has 'main_window' =>
 has "$_" => lazy_build ro Str
     for (qw{override_liveos_mountpoint override_boot_device override_system_partition});


+has 'persistence_partition_device_file'=> lazy_build ro Str, metaclass => 'NoGetopt';
 has 'persistence_partition_size'     => lazy_build ro Int,  metaclass => 'NoGetopt';
 has 'persistence_is_enabled'         => lazy_build ro Bool, metaclass => 'NoGetopt';
 has 'persistence_is_read_write'      => lazy_build ro Bool, metaclass => 'NoGetopt';
@@ -270,6 +271,12 @@ sub _build_size_of_free_space {
   );
 }


+sub _build_persistence_partition_device_file {
+    my $self = shift;
+    
+    $self->get_device_property($self->persistence_partition, 'DeviceFilePresentation');
+}
+
 sub _build_persistence_partition_size {
     my $self = shift;


@@ -695,6 +702,7 @@ sub step_object_from_name {
                 $self->delete_persistence_partition({ @_ })
             },
             persistence_partition      => $self->persistence_partition,
+            persistence_partition_device_file => $self->persistence_partition_device_file,
             persistence_partition_size => $self->persistence_partition_size,
         );
     }
@@ -705,6 +713,7 @@ sub step_object_from_name {
             },
             configuration              => $self->configuration,
             persistence_partition      => $self->persistence_partition,
+            persistence_partition_device_file => $self->persistence_partition_device_file,
             persistence_partition_size => $self->persistence_partition_size,
         );
     }
diff --git a/lib/Tails/Persistence/Step/Configure.pm b/lib/Tails/Persistence/Step/Configure.pm
index 9f3d4a0..e2c33cf 100644
--- a/lib/Tails/Persistence/Step/Configure.pm
+++ b/lib/Tails/Persistence/Step/Configure.pm
@@ -31,7 +31,7 @@ textdomain("tails-persistence-setup");


has 'configuration' => required ro 'Tails::Persistence::Configuration';

-has 'persistence_partition'      => required ro Str;
+has 'persistence_partition_device_file' => required ro Str;
 has 'persistence_partition_size' => required ro Int;


 has 'list_box' => lazy_build ro 'Gtk2::VBox';
@@ -66,7 +66,7 @@ sub BUILD {
     $self->description->set_markup($self->encoding->decode(sprintf(
         # TRANSLATORS: partition, size, device vendor, device model
         gettext(q{The selected files will be stored in the encrypted partition %s (%s), on the <b>%s %s</b> device.}),
-        $self->persistence_partition,
+        $self->persistence_partition_device_file,
         format_bytes($self->persistence_partition_size, mode => "iec"),
         $self->device_vendor,
         $self->device_model
diff --git a/lib/Tails/Persistence/Step/Delete.pm b/lib/Tails/Persistence/Step/Delete.pm
index 747dadd..0b5857a 100644
--- a/lib/Tails/Persistence/Step/Delete.pm
+++ b/lib/Tails/Persistence/Step/Delete.pm
@@ -25,10 +25,11 @@ textdomain("tails-persistence-setup");


=cut

-has 'persistence_partition'      => required ro Str;
+has 'persistence_partition_device_file' => required ro Str;
 has 'persistence_partition_size' => required ro Int;
 has 'warning_icon'               => lazy_build rw 'Gtk2::Image';


+
=head1 CONSTRUCTORS

 =cut
@@ -45,7 +46,7 @@ sub BUILD {
     # TRANSLATORS: partition, size, device vendor, device model
     $self->description->set_markup($self->encoding->decode(sprintf(
         gettext(q{The persistent volume %s (%s), on the <b>%s %s</b> device, will be deleted.}),
-        $self->persistence_partition,
+        $self->persistence_partition_device_file,
         format_bytes($self->persistence_partition_size, mode => "iec"),
         $self->device_vendor,
         $self->device_model
-- 
1.7.9.5