dracut/0016-luks-key-on-ext-dev-wait-for-luks.patch

40 lines
1.8 KiB
Diff
Raw Normal View History

2011-10-19 13:30:00 +00:00
From 2e0c003435bbc0751cdf7466c0faebe7bfc7445b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Przemys=C5=82aw=20Rudy?= <prudy1@o2.pl>
Date: Mon, 22 Aug 2011 11:27:00 +0200
Subject: [PATCH] luks key on ext dev - wait for luks
This really waits for the luks mapper device, so luksOpen can do it job
---
modules.d/90crypt/parse-crypt.sh | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index ff86700..1e78aa9 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -24,8 +24,22 @@ else
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
- printf -- '[ -e /dev/disk/by-uuid/*%s* ]\n' $luksid \
- >> $hookdir/initqueue/finished/90-crypt.sh
+
+ [ -e $hookdir/initqueue/finished/90-crypt.sh ] || \
+ {
+ printf -- 'UUIDS=:\n'
+ printf -- 'for dm in /dev/dm-*; do\n'
+ printf -- '[ -e "$dm" ] || exit 1\n'
+ printf -- 'dmid=`/sbin/dmsetup info -c -o uuid --noheadings "$dm"`\n'
+ printf -- 'uuid=${dmid#CRYPT-LUKS*-}\n'
+ printf -- '[ "x$uuid" = "x$dmid" ] && continue\n'
+ printf -- 'UUIDS="${UUIDS}${uuid%%%%-*}:"\n'
+ printf -- 'done\n'
+ } > $hookdir/initqueue/finished/90-crypt.sh
+ uuid=$luksid
+ while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
+ printf -- '[ "x${UUIDS#*:%s:}" != "x$UUIDS" ] || exit 1\n' $uuid >> $hookdir/initqueue/finished/90-crypt.sh
+
{
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid