From 3e60ed9eee5e02aafdff98d87d63b627ca3f87bb Mon Sep 17 00:00:00 2001 From: Christian Giessner Date: Sat, 15 Jan 2011 17:51:24 +0100 Subject: [PATCH] Add support for UUID to crypt_root (bug #315467) --- defaults/initrd.scripts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index e258d3e..71f3550 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -761,6 +761,33 @@ openLUKS() { whereis "LUKS_KEYDEV" "${LUKS_NAME} key device" KEYDEV_ERROR=0 else + case "${LUKS_DEVICE}" in + UUID\=*) + REAL_LUKS="" + retval=1 + + if [ "${retval}" -ne '0' ]; then + REAL_LUKS=`findfs "${LUKS_DEVICE}" 2>/dev/null` + retval=$? + fi + + if [ "$retval" -ne '0' ]; then + REAL_LUKS=`busybox findfs "${LUKS_DEVICE}" 2>/dev/null` + retval=$? + fi + + if [ "${retval}" -ne '0' ]; then + REAL_LUKS=`blkid -t "${LUKS_DEVICE}" | cut -d ":" -f 1 2>/dev/null` + retval=$? + fi + + if [ "${retval}" -eq '0' ] && [ -n "${REAL_LUKS}" ]; then + good_msg "Detected device ${REAL_LUKS}" + LUKS_DEVICE="${REAL_LUKS}" + fi + ;; + esac + setup_md_device ${LUKS_DEVICE} cryptsetup isLuks ${LUKS_DEVICE} if [ $? -ne 0 ] -- 2.26.2