If you don't have a crypttab, and you've got dmraid, we can't count on
the luks-XXXXXX name to be the UUID; instead, it's the device. But to
be more generic, check and see if it's a valid /dev/mapper/ path, and if
it is, use it.
---
mkinitrd | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/mkinitrd b/mkinitrd
index b20ee40..e3eb99c 100755
--- a/mkinitrd
+++ b/mkinitrd
@@ -1582,9 +1582,16 @@ emitdmraids
emitcrypto()
{
- local luksuuid=$(grep "^$2 " /etc/crypttab | awk '{ print $2 }')
+ local luksuuid=""
+ if [ -f /etc/crypttab ]; then
+ luksuuid=$(grep "^$2 " /etc/crypttab | awk '{ print $2 }')
+ fi
if [ -z "$luksuuid" ]; then
- luksuuid="UUID=${2##luks-}"
+ if [ "$1" == "/dev/mapper/${2##luks-}" ]; then
+ luksuuid="$1"
+ else
+ luksuuid="UUID=${2##luks-}"
+ fi
fi
emit "setDeviceEnv LUKSUUID $luksuuid"
emit "echo Setting up disk encryption: \$LUKSUUID"