Fixup for bugs from patch in bug 174294.
authorRobin H. Johnson <robbat2@gentoo.org>
Fri, 27 Jul 2007 06:24:28 +0000 (06:24 +0000)
committerRobin H. Johnson <robbat2@gentoo.org>
Fri, 27 Jul 2007 06:24:28 +0000 (06:24 +0000)
The previous patch from bug #174294 still contained some bugs in the linuxrc
and scripts, that caused a failure during boot. Clean them up with one more
patch from Nelson Batalha <nelson_batalha@hotmail.com>, again on bug #174294.

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@523 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
generic/initrd.scripts
generic/linuxrc

index 35181819fdde6a24b4c8df9c6137fcc89be4fce1..cfe9ccf63a97c687e71b9678da21b60998385b92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
 # Copyright 2006-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  26 Jul 2007; Robin H. Johnson <robbat2@gentoo.org> generic/initrd.scripts,
+  generic/linuxrc:
+  The previous patch from bug #174294 still contained some bugs in the linuxrc
+  and scripts, that caused a failure during boot. Clean them up with one more
+  patch from Nelson Batalha <nelson_batalha@hotmail.com>, again on bug #174294.
+
   26 Jul 2007; Andrew Gaffney <agaffney@gentoo.org> netboot/linuxrc.x:
   enhanced netboot linuxrc from gustavoz
 
index 4493bf89028a8dce3d22972baad0d09c2a8cc409..2a03d81e9364b75e1a4f0b5ddbf13b0d31bcc99e 100644 (file)
@@ -108,26 +108,33 @@ findkeymount() {
                         # Check for a block device to mount
                         if [ -b "${x}" ]
                         then
-                                good_msg "Attempting to mount key media:- ${x}"
-                                mount -r -t auto ${x} ${NEW_ROOT}/mnt/key \
+                               if [ ${crypt_silent} = '' ]
+                               then
+                                       good_msg "Attempting to mount key media:- ${x}"
+                               fi
+
+                                mount -r -t auto ${x} ${NEW_ROOT}/mnt/keydev \
                                                 > /dev/null 2>&1
-                                fi
                                 if [ "$?" = '0' ]
                                 then
                                         # Check for the key
-                                        if [ -e ${NEW_ROOT}/mnt/key/${SUBDIR}/${KEYNAME} ]
+                                        if [ -e ${NEW_ROOT}/mnt/keydev/${LUKS_ROOT_KEY} ]
                                         then
-                                                KEY_ROOT="${x}"
+                                                LUKS_ROOT_KEYDEV="${x}"
+                                               umount ${NEW_ROOT}/mnt/keydev
                                                 break
                                         else
-                                                umount ${NEW_ROOT}/mnt/key
+                                                umount ${NEW_ROOT}/mnt/keydev
                                         fi
                                 fi
                         fi
                 done
-                if [ "${KEY_ROOT}" != '' ]
+                if [ "${LUKS_ROOT_KEYDEV}" != '' ]
                 then
-                        good_msg "Key media found on ${x}"
+                       if [ ${crypt_silent} = '' ]
+                       then
+                               good_msg "Key media found on ${x}"
+                       fi
                 fi
         fi
 }
index 6d7c74b0bd28028c49b1762e96bbf09b830516c0..269a27efeecd2bd123e039e9ebcb8abb91081706 100644 (file)
@@ -72,16 +72,13 @@ do
                        CDROOT=1
                        CDROOT_DEV=`parse_opt "${x}"`
                ;;
-               # Start livecd loop, looptype options and encryption
+               # Start livecd loop, looptype options
                loop\=*)
                        LOOP=`parse_opt "${x}"`
                ;;
                looptype\=*)
                        LOOPTYPE=`parse_opt "${x}"`
                ;;
-               loop_crypt\=*)
-                       LOOP_CRYPT=`parse_opt "${x}"`
-               ;;
                # Start Device Manager options 
                devfs)
                        USE_DEVFS_NORMAL=1
@@ -182,6 +179,9 @@ do
                crypt_swap\=*)
                        LUKS_SWAP=`parse_opt "${x}"`
                ;;
+               crypt_silent\=*)
+                       LUKS_SILENT=`parse_opt "${x}"`
+               ;;
                real_rootflags\=*)
                        REAL_ROOTFLAGS=`parse_opt "${x}"`
                ;;
@@ -236,8 +236,11 @@ setup_md_device
 # Scan volumes
 startVolumes
 
-# Initialize LUKS root device
-startLUKS
+# Initialize LUKS root device except for livecd's
+if [ "${CDROOT}" -ne '1' ]
+then
+       startLUKS
+fi
 
 # Set up unionfs
 mkdir -p ${NEW_ROOT}
@@ -264,7 +267,7 @@ then
                mount -t tmpfs tmpfs ${NEW_ROOT}
        fi
        
-       for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+       for i in dev mnt mnt/cdrom mnt/livecd mnt/keydev tmp tmp/.initrd mnt/gentoo sys
        do
                mkdir -p ${NEW_ROOT}/$i
                chmod 755 ${NEW_ROOT}/$i
@@ -496,37 +499,41 @@ then
        
 
         # If encrypted, find key and mount, otherwise mount as usual
-       if [ "${LOOP_CRYPT}" != '' ] 
+       if [ "${LUKS_ROOT}" != '' ] 
        then
-               good_msg 'You booted an encrypted livecd'
-               KEYNAME=$(head -n 1 ${NEW_ROOT}/mnt/cdrom/livecd)
+               if [ "${LUKS_SILENT}" = '' ]
+               then
+                       good_msg 'You booted an encrypted livecd'
+               fi
 
-               if [ "${KEYNAME}" = '' ]
-               then 
-                       good_msg 'It's not locked with a gpg key, attempting to decrypt manually'
-                       losetup -e ${LOOP_CRYPT} /dev/loop1 ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}
-                       
+               LUKS_ROOT_KEY=$(head -n 1 ${NEW_ROOT}/mnt/cdrom/livecd)
 
-               else 
-                       good_msg 'Livecd locked with gpg key'
+               if [ "${LUKS_ROOT_KEY}" ]
+               then
                        bootstrapKey
-                       good_msg 'Attempting to decrypt with key'
-                       losetup -K ${NEW_ROOT}/mnt/key/${SUBDIR}/${KEYNAME} -e ${LOOP_CRYPT} /dev/loop1 \
-                               ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}
                fi
-
-               test_success 'Unencrypting loop'
+               
+               losetup /dev/loop0 ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}
+               
+               test_success 'Preparing loop filesystem'
+               
+               LUKS_ROOT='/dev/loop0'
+               
+               startLUKS
                
                case ${LOOPTYPE} in
-                       squashfs)
-                               MOUNTTYPE="squashfs"
                        normal)
                                MOUNTTYPE="ext2"
-               esac
+                               ;;
+                       *)
+                               MOUNTTYPE="${LOOPTYPE}"
+                               ;;
+               esac            
 
-               mount -t ${MOUNTTYPE} -o ro /dev/loop1 ${NEW_ROOT}/mnt/livecd 
-                               
-               test_success 'Mount filesystem, checking key'   
+
+               mount -t ${MOUNTTYPE} -o ro /dev/mapper/root ${NEW_ROOT}/mnt/livecd 
+               
+               test_success 'Mount filesystem' 
                FS_LOCATION='mnt/livecd'
 
 
@@ -590,7 +597,7 @@ then
                        test_success 'mount /dev/loop0 /'
                        FS_LOCATION='mnt/livecd'
                fi
-       
+       fi
 #
 # End cdrom looptype determination and mounting if necessary
 #