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

このメッセージを削除

このメッセージに返信
著者: Andres Gomez Ramirez
日付:  
To: The Tails public development discussion list
題目: Re: [Tails-dev] Persistence: display nicer paths
Done, I attached two new patches to "Persistence: display nicer paths".

Cheers,

Andres
________________________________________
From: tails-dev-bounces@??? [tails-dev-bounces@???] on behalf of intrigeri [intrigeri@???]
Sent: 19 December 2013 12:38
To: The Tails public development discussion list
Subject: Re: [Tails-dev] Persistence: display nicer paths

Hi Andres,

Andres Gomez Ramirez wrote (18 Dec 2013 22:20:48 GMT) :
> Attached the second version, [...]


Merged, great work!

Added a few fixes on top (53cd9d1, 4f3f54f), that you surely want to
look at and avoid the need thereof next time (that is: first,
configure Git to use color in diffs, so that trailing whitespace jumps
at your eye; second, run the test suite to make sure your changes
don't break it :)

Released as tails-persistence-setup 1.0.2, uploaded to devel and
experimental, will be part of Tails 0.23. Congrats!

I know you already committed to another task (some liveusb-creator bug
IIRC), but as a follow-up on this one (#5311), you might want to take
care of other places where the Persistent Volume Assistant displays
ugly paths, e.g. in "Tails is running from non-USB / non-SDIO device
%s." and other checks. It is certainly not critical, but I assume it
should be pretty easy to wrap ->boot_device with something that
returns DeviceFilePresentation in:

            my $message = $self->encoding->decode(sprintf(
                gettext($check->{message}),
                $self->boot_device));


Time to add a boot_device_file lazy-built attribute to
Tails::RunningSystem in our perl5lib, perhaps?

Cheers,
--
intrigeri
| GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
| OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc

_______________________________________________
tails-dev mailing list
tails-dev@???
https://mailman.boum.org/listinfo/tails-dev
From b1a669a8404d2a9dccad4de84d7711291afcf7ab Mon Sep 17 00:00:00 2001
From: kurono <andres.gomez@???>
Date: Sun, 22 Dec 2013 13:30:22 +0100
Subject: [PATCH] persistence: display nicer paths - extend

---
lib/Tails/RunningSystem.pm | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/lib/Tails/RunningSystem.pm b/lib/Tails/RunningSystem.pm
index e7a5c93..4d6258c 100644
--- a/lib/Tails/RunningSystem.pm
+++ b/lib/Tails/RunningSystem.pm
@@ -63,6 +63,10 @@ has 'boot_device' =>
     lazy_build rw Str,
     documentation => q{The UDI of the physical block device where Tails is installed, e.g. /org/freedesktop/UDisks/devices/sdb.};


+has 'boot_device_file' =>
+    lazy_build rw Str,
+    documentation => q{The rute of the file where Tails is installed, e.g. /dev/sdb.};
+
 has 'system_partition' =>
     lazy_build rw Str,
     documentation => q{The UDI of the partition where Tails is installed, e.g. /org/freedesktop/UDisks/devices/sdb1.};
@@ -145,6 +149,12 @@ sub _build_boot_device {
     return $device;
 }


+sub _build_boot_device_file {
+    my $self = shift;
+
+    $self->get_device_property($self->boot_device, 'DeviceFilePresentation');
+}
+
 sub _build_system_partition {
     my $self = shift;


--
1.7.9.5

From 71feda6a517573d261bfcd9b219c53de7f2febfa Mon Sep 17 00:00:00 2001
From: kurono <andres.gomez@???>
Date: Sun, 22 Dec 2013 13:35:49 +0100
Subject: [PATCH] persistence: display nicer paths - extend

---
lib/Tails/Persistence/Setup.pm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/Tails/Persistence/Setup.pm b/lib/Tails/Persistence/Setup.pm
index bf8b394..cefb080 100644
--- a/lib/Tails/Persistence/Setup.pm
+++ b/lib/Tails/Persistence/Setup.pm
@@ -81,7 +81,7 @@ has 'running_system' =>
     lazy_build ro 'Tails::RunningSystem',
     metaclass => 'NoGetopt',
     handles   => [
-        qw{boot_device boot_device_model boot_device_vendor boot_device_size
+        qw{boot_device boot_device_model boot_device_vendor boot_device_size boot_device_file
            started_from_device_installed_with_tails_installer}
     ];


@@ -439,7 +439,7 @@ sub check_sanity {
         if (! $res) {
             my $message = $self->encoding->decode(sprintf(
                 gettext($check->{message}),
-                $self->boot_device));
+                $self->boot_device_file));
             if ($self->force && exists($check->{can_be_forced}) && $check->{can_be_forced}) {
                 warn "$message",
                      "... but --force is enabled, ignoring results of this sanity check.";
@@ -461,7 +461,7 @@ sub check_sanity {
 sub run {
     my $self = shift;


-    $self->debug(sprintf("Working on device %s", $self->boot_device));
+    $self->debug(sprintf("Working on device %s", $self->boot_device_file));


     # Force initialization in the correct order
     if ($Moose::VERSION >= 2) {
@@ -521,7 +521,7 @@ sub create_persistence_partition {


     $self->debug(sprintf(
         "Creating partition of size %s at offset %s on device %s",
-        format_bytes($size, mode => "iec"), $offset, $self->boot_device
+        format_bytes($size, mode => "iec"), $offset, $self->boot_device_file
     ));


     if ($opts->{async}) {
@@ -563,7 +563,7 @@ sub delete_persistence_partition {
     $opts->{async}     ||= 0;
     $opts->{end_cb}    ||= sub { say STDERR "finished." };


-    $self->debug(sprintf("Deleting partition %s", $self->persistence_partition));
+    $self->debug(sprintf("Deleting partition %s", $self->persistence_partition_device_file));


     # lock the device if it is unlocked
     my $luksholder = $self->persistence_partition_is_unlocked;
@@ -602,7 +602,7 @@ sub mount_persistence_partition {
     $opts->{async}     ||= 0;
     $opts->{end_cb}    ||= sub { say STDERR "finished." };


-    $self->debug(sprintf("Mounting partition %s", $self->persistence_partition));
+    $self->debug(sprintf("Mounting partition %s", $self->persistence_partition_device_file));


     my $luks_holder = $self->get_device_property(
         $self->persistence_partition, 'LuksHolder');
-- 
1.7.9.5