From ac3822ad30cebfd1a3257fb08716494ca9ec0ab7 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 20 Oct 2013 11:10:19 +0200 Subject: [PATCH] 00-crypt.sh: move /sbin/cryptsetup path to ${CRYPTSETUP_BIN} --- defaults/initrd.d/00-crypt.sh | 12 ++++++------ defaults/initrd.defaults | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/defaults/initrd.d/00-crypt.sh b/defaults/initrd.d/00-crypt.sh index 552a886..a0dc45e 100755 --- a/defaults/initrd.d/00-crypt.sh +++ b/defaults/initrd.d/00-crypt.sh @@ -52,11 +52,6 @@ _open_luks() { local dev_error=0 key_error=0 keydev_error=0 local mntkey="/mnt/key/" cryptsetup_opts="" - if [ ! -e /sbin/cryptsetup ]; then - bad_msg "The ramdisk does not support LUKS" - return 1 - fi - local real_dev= if [ "${ltype}" = "ROOT" ]; then real_dev="${REAL_ROOT}" @@ -214,7 +209,7 @@ _open_luks() { fi # At this point, keyfile or not, we're ready! - local cmd="${gpg_cmd}/sbin/cryptsetup" + local cmd="${gpg_cmd}${CRYPTSETUP_BIN}" cmd="${cmd} ${cryptsetup_opts} open ${luks_device} ${luks_dev_name}" _crypt_exec "${luks_device}" "${cmd}" local ret="${?}" @@ -264,6 +259,11 @@ _open_luks() { } start_luks() { + if [ ! -e "${CRYPTSETUP_BIN}" ]; then + bad_msg "${CRYPTSETUP_BIN} not found inside the initramfs" + return 1 + fi + # TODO(lxnay): this sleep 6 thing is hurting my eyes sooooo much. # if key is set but key device isn't, find it [ -n "${CRYPT_ROOT_KEY}" ] && [ -z "${CRYPT_ROOT_KEYDEV}" ] \ diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 441ed8c..40db2b7 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -67,6 +67,8 @@ PLYMOUTHD_BIN="/sbin/plymouthd" PLYMOUTH_BIN="/bin/plymouth" [ ! -e "${PLYMOUTH_BIN}" ] && PLYMOUTH_BIN="/usr/bin/plymouth" +CRYPTSETUP_BIN="/sbin/cryptsetup" + REAL_ROOT="" CONSOLE="/dev/console" NEW_ROOT="/newroot"