|
|
|
@ -549,21 +549,60 @@ startVolumes() {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startLUKS() {
|
|
|
|
|
if [ -n "${LUKS_ROOT}" ]
|
|
|
|
|
then
|
|
|
|
|
# Open a LUKS device
|
|
|
|
|
# $1 LUKS device
|
|
|
|
|
# $2 LUKS name
|
|
|
|
|
openLUKS() {
|
|
|
|
|
LUKS_DEVICE="$1"
|
|
|
|
|
LUKS_NAME="$2"
|
|
|
|
|
if [ -e /sbin/cryptsetup ]
|
|
|
|
|
then
|
|
|
|
|
if cryptsetup isLuks ${LUKS_ROOT}
|
|
|
|
|
while [ 1 ]
|
|
|
|
|
do
|
|
|
|
|
if [ "${LUKS_DEVICE}" = '' ]
|
|
|
|
|
then
|
|
|
|
|
# LUKS device could not be opened. Prompt user for device.
|
|
|
|
|
bad_msg "The LUKS ${LUKS_NAME} block device is not detected."
|
|
|
|
|
echo " Please specify a ${LUKS_NAME} LUKS device to open, "q" to skip, or "shell" for a shell..."
|
|
|
|
|
echo -n "LUKS ${LUKS_NAME}() :: "
|
|
|
|
|
read LUKS_DEVICE
|
|
|
|
|
continue
|
|
|
|
|
elif [ "${LUKS_DEVICE}" = 'shell' ]
|
|
|
|
|
then
|
|
|
|
|
good_msg "Opening LUKS device ${LUKS_ROOT}"
|
|
|
|
|
run_shell
|
|
|
|
|
|
|
|
|
|
cryptsetup luksOpen ${LUKS_ROOT} root
|
|
|
|
|
LUKS_DEVICE=''
|
|
|
|
|
continue
|
|
|
|
|
elif [ "${LUKS_DEVICE}" = 'q' ]
|
|
|
|
|
then
|
|
|
|
|
break
|
|
|
|
|
else
|
|
|
|
|
if cryptsetup isLuks ${LUKS_DEVICE}
|
|
|
|
|
then
|
|
|
|
|
good_msg "Opening LUKS device ${LUKS_DEVICE}"
|
|
|
|
|
|
|
|
|
|
cryptsetup luksOpen ${LUKS_DEVICE} ${LUKS_NAME}
|
|
|
|
|
if [ ! "$?" -eq '0' ]
|
|
|
|
|
then
|
|
|
|
|
bad_msg "Failed open LUKS device ${LUKS_ROOT}"
|
|
|
|
|
bad_msg "Failed open LUKS device ${LUKS_DEVICE}"
|
|
|
|
|
else
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
bad_msg "The LUKS device ${LUKS_DEVICE} does not contain a LUKS header"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
LUKS_DEVICE=''
|
|
|
|
|
done
|
|
|
|
|
else
|
|
|
|
|
bad_msg "The initrd does not support LUKS"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startLUKS() {
|
|
|
|
|
if [ -n "${LUKS_ROOT}" ]
|
|
|
|
|
then
|
|
|
|
|
openLUKS "${LUKS_ROOT}" "root"
|
|
|
|
|
if [ -n "${REAL_ROOT}" ]
|
|
|
|
|
then
|
|
|
|
|
# Rescan volumes
|
|
|
|
@ -571,12 +610,11 @@ startLUKS() {
|
|
|
|
|
else
|
|
|
|
|
REAL_ROOT="/dev/mapper/root"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
bad_msg "The LUKS device ${LUKS_ROOT} does not contain a LUKS hearder"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
bad_msg "The initrd does not support LUKS"
|
|
|
|
|
fi
|
|
|
|
|
if [ -n "${LUKS_SWAP}" ]
|
|
|
|
|
then
|
|
|
|
|
openLUKS "${LUKS_SWAP}" "swap"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|