mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: "Przemysław Rudy" <prudy1-h7QdYz1kt/Q@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/2] luks key on ext dev - wait for luks
Date: Tue, 07 Jun 2011 20:17:19 +0200	[thread overview]
Message-ID: <islpvf$tn5$1@dough.gmane.org> (raw)

This really waits for the luks mapper device, so luksOpen can do it job:

 modules.d/90crypt/parse-crypt.sh |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index 7ec232a..a2d64a0 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -23,8 +23,20 @@ else
                 printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
             } >> /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

             reply	other threads:[~2011-06-07 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 18:17 Przemysław Rudy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-07 18:26 [PATCH 1/2] luks key on ext dev - wait for luks Przemysław Rudy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='islpvf$tn5$1@dough.gmane.org' \
    --to=prudy1-h7qdyz1kt/q@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox