[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Improve handling of logical volume device names when encrypted.



Use of the /dev/mapper/VolGroupXX-LogVolXX node allows us to rely on the basename being unique.
---
 cryptodev.py  |    5 +----
 partitions.py |    5 +++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/cryptodev.py b/cryptodev.py
index a651625..47ae350 100644
--- a/cryptodev.py
+++ b/cryptodev.py
@@ -79,11 +79,8 @@ class LUKSDevice:
 
         self._device = device
         if device is not None:
-            if device.startswith("/dev/"):
-                device = device[5:]
-
             name = "%s-%s" % (self.scheme.lower(),
-                              device.replace("/", "-"))
+                              os.path.basename(device))
             self.setName(name)
 
     def getDevice(self, encrypted=0):
diff --git a/partitions.py b/partitions.py
index 1f1e7b8..a9bf132 100644
--- a/partitions.py
+++ b/partitions.py
@@ -204,8 +204,9 @@ class Partitions:
             return
 
         buttons = [_("Back"), _("Continue")]
+        devname = os.path.basename(device)
         while True:
-            (passphrase, isglobal) = intf.passphraseEntryWindow(device)
+            (passphrase, isglobal) = intf.passphraseEntryWindow(devname)
             if not passphrase:
                 rc = intf.messageWindow(_("Confirm"),
                                         _("Are you sure you want to skip "
@@ -214,7 +215,7 @@ class Partitions:
                                           "If you skip this step the "
                                           "device's contents will not "
                                           "be available during "
-                                          "installation.") % device,
+                                          "installation.") % devname,
                                         type = "custom",
                                         default = 0,
                                         custom_buttons = buttons)
-- 
1.5.4.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]