[arch-projects] [PATCH] UUID support for kernel cmdline argument cryptdevice

Andrwe Lord Weber archlinux at andrwe.org
Sun Jun 12 13:08:17 EDT 2011


Hi,

I just encoutered the problem that my system couldn't boot because the devices changed and the encrypt hook couldn't decrypt my system.
Because UUIDs are more reliable in such cases I added a new syntax to the hook.
if you set cryptdevice=UUID=<UUID>:root UUID will be used to get the real device using "blkid -U".

Signed-off-by: Andrwe Lord Weber <archlinux at andrwe.org>
---
 cryptsetup/trunk/PKGBUILD     |    2 +-
 cryptsetup/trunk/encrypt_hook |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/cryptsetup/trunk/PKGBUILD b/cryptsetup/trunk/PKGBUILD
index 0af6df5..fd6c387 100644
--- a/cryptsetup/trunk/PKGBUILD
+++ b/cryptsetup/trunk/PKGBUILD
@@ -15,7 +15,7 @@ source=(http://cryptsetup.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2
         encrypt_hook
 	encrypt_install)
 sha256sums=('7ceb18a0c91fa1546077b41b93463dd2ec9d7f83e6fd93757fb84cc608206a6a'
-            '64601eae6fbf3e3afceccec5877557aa208a82497c33cc94ad0a686b4022b5dc'
+            'fcd107764ef6de8e3dfb8864c15e7e4cf2ef394b57bb70f8c6978123d0c9f8b6'
             '07918fc349b3a7c4a73e8ad1cc3d97a2a79ebc7655090ab9ebb00b1e092c85aa')
 
 build() {
diff --git a/cryptsetup/trunk/encrypt_hook b/cryptsetup/trunk/encrypt_hook
index e84bc6e..270edd2 100644
--- a/cryptsetup/trunk/encrypt_hook
+++ b/cryptsetup/trunk/encrypt_hook
@@ -39,6 +39,11 @@ run_hook ()
         if [ -n "${cryptdevice}" ]; then
             DEPRECATED_CRYPT=0
             cryptdev="$(echo "${cryptdevice}" | cut -d: -f1)"
+	    # Check if given device is introduced by UUID=
+            if [[ "$(echo "${cryptdev}" | cut -d= -f1)" = "UUID" ]]; then
+	        # get device of given UUID and set it as cryptdev
+                cryptdev="$(blkid -U $(echo "${cryptdev}" | cut -d= -f2))"
+            fi
             cryptname="$(echo "${cryptdevice}" | cut -d: -f2)"
         else
             DEPRECATED_CRYPT=1
-- 
1.7.5.2




More information about the arch-projects mailing list