Re: [arch-projects] [PATCH] UUID support for kernel cmdline argument cryptdevice
On Sun, 12 Jun 2011 13:28:30 -0400, Dave Reisner wrote:
On Sun, Jun 12, 2011 at 07:08:17PM +0200, Andrwe Lord Weber wrote:
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@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
if [ "${cryptdev:0:5}" = 'UUID=' ]; then
Even though Busybox allows [[ ]], we don't use them because they're functionally equivalent to [ ]. Since busybox ash is closer to POSIX than Bash, we opt for the more POSIX-like syntax.
Didn't know. Thanks.
+ # get device of given UUID and set it as cryptdev + cryptdev="$(blkid -U $(echo "${cryptdev}" | cut -d= -f2))"
cryptdev=$(blkid -t "$cryptdev" -o device)
Quotes are unnecessary in assigning a command substituion.
Ok.
+ fi cryptname="$(echo "${cryptdevice}" | cut -d: -f2)" else DEPRECATED_CRYPT=1 --
Since this hook is actually part of cryptsetup, it might be better served as a bug report on flyspray.
regards, dave
Then I'll make the changes and post the patch in a bug report on flyspray. Thanks. Kind regards, Andrwe
participants (1)
-
Andrwe