# Copyright 2006-2006 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 25 Oct 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+ generic/initrd.scripts, generic/linuxrc:
+ Updated with the latest version of the LUKS patches from bug #152441.
+
25 Oct 2006; Chris Gianelloni <wolf31o2@gentoo.org> ChangeLog:
Changed mime-type to application/x-gzip for generic/keymaps.tar.gz for bug
#151500.
# Here, we check for /dev/device-mapper, and if it exists, we setup a
# a symlink, which should hopefully fix bug #142775 and bug #147015
- if [ -e /dev/device-mapper ]
+ if [ -e /dev/device-mapper ] && [ ! -e /dev/mapper/control ]
then
mkdir -p /dev/mapper
ln -sf /dev/device-mapper /dev/mapper/control
fi
}
+startLUKS() {
+ if [ -n "${LUKS_ROOT}" ]
+ then
+ if [ -e /sbin/cryptsetup ]
+ then
+ if cryptsetup isLuks ${LUKS_ROOT}
+ then
+ good_msg "Opening LUKS device ${LUKS_ROOT}"
+
+ cryptsetup luksOpen ${LUKS_ROOT} root
+ if [ ! "$?" -eq '0' ]
+ then
+ bad_msg "Failed open LUKS device ${LUKS_ROOT}"
+ fi
+
+ if [ -n "${REAL_ROOT}" ]
+ then
+ # Rescan volumes
+ startVolumes
+ 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
+ fi
+}
+
sdelay() {
# Sleep a specific number of seconds if SDELAY is set otherwise only sleep
# 1 second
NFSROOT=`parse_opt "${x}"`
;;
crypt_root\=*)
- CRYPT_ROOT=`parse_opt "${x}"`
+ LUKS_ROOT=`parse_opt "${x}"`
;;
esac
done
# Scan volumes
startVolumes
-# Iinitialize encrypted root device
-if [ -n "${CRYPT_ROOT}" ]
-then
- cryptsetup luksOpen ${CRYPT_ROOT} root || exit -1
-
- if [ -n "${REAL_ROOT}" ]
- then
- # Rescan volumes
- startVolumes
- else
- REAL_ROOT="/dev/mapper/root"
- fi
-fi
+# Iinitialize LUKS root device
+startLUKS
# Set up unionfs
mkdir -p ${NEW_ROOT}