Updated with the latest version of the LUKS patches from bug #152441.
authorChris Gianelloni <wolf31o2@gentoo.org>
Wed, 25 Oct 2006 22:44:31 +0000 (22:44 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Wed, 25 Oct 2006 22:44:31 +0000 (22:44 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@455 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
generic/initrd.scripts
generic/linuxrc

index 90ec22e37601ad4828756a2269125470c3d8ea67..c3a814f73d750bb79dd8ff46b2d3ca5746745a96 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 # 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.
index 4a609bc67fd025cc120d92f62f67d55f5e8aecab..08ed27ff69bfcd29632383723f0d0da9e8660a8c 100644 (file)
@@ -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
index 3f3909d0966f2d4a71cffb3bd169d0621652dbe9..441c09f474849000660791e1c6a34c9c7837b98f 100644 (file)
@@ -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}