From: Chris Gianelloni Date: Wed, 25 Oct 2006 22:44:31 +0000 (+0000) Subject: Updated with the latest version of the LUKS patches from bug #152441. X-Git-Tag: v3.4.10.902~297 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=908e45924c4b16936cfe01d539664bcbc648671e;p=genkernel.git Updated with the latest version of the LUKS patches from bug #152441. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@455 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/ChangeLog b/ChangeLog index 90ec22e..c3a814f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ # Copyright 2006-2006 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 25 Oct 2006; Chris Gianelloni + generic/initrd.scripts, generic/linuxrc: + Updated with the latest version of the LUKS patches from bug #152441. + 25 Oct 2006; Chris Gianelloni ChangeLog: Changed mime-type to application/x-gzip for generic/keymaps.tar.gz for bug #151500. diff --git a/generic/initrd.scripts b/generic/initrd.scripts index 4a609bc..08ed27f 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -492,7 +492,7 @@ startVolumes() { # 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 @@ -549,6 +549,37 @@ startVolumes() { 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 diff --git a/generic/linuxrc b/generic/linuxrc index 3f3909d..441c09f 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -173,7 +173,7 @@ do NFSROOT=`parse_opt "${x}"` ;; crypt_root\=*) - CRYPT_ROOT=`parse_opt "${x}"` + LUKS_ROOT=`parse_opt "${x}"` ;; esac done @@ -226,19 +226,8 @@ setup_md_device # 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}