Switch to detection for LOOP and LOOPTYPE when they are not set.
authorChris Gianelloni <wolf31o2@gentoo.org>
Thu, 14 Feb 2008 06:01:03 +0000 (06:01 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Thu, 14 Feb 2008 06:01:03 +0000 (06:01 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@597 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
generic/initrd.defaults
generic/initrd.scripts
generic/linuxrc

index 80124acec0b6ed3cf1c73fbf762c53fb80acc065..46ac459af7fa8d9364787d13a2d27b44d287d9fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,12 +2,16 @@
 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  14 Feb 2008; Chris Gianelloni <wolf31o2@gentoo.org>
+  generic/initrd.defaults, generic/initrd.scripts, generic/linuxrc:
+  Switch to detection for LOOP and LOOPTYPE when they are not set.
+
   14 Feb 2008; Chris Gianelloni <wolf31o2@gentoo.org>
   generic/initrd.scripts, generic/linuxrc:
   Performed some minor cleanup.
 
   14 Feb 2008; Chris Gianelloni <wolf31o2@gentoo.org> generic/linuxrc:
-  Move busybox --install -s to outside the /init check. Fix problems with
+  Move "busybox --install -s" to outside the /init check. Fix problems with
   running mknod on a non-CD root filesystem, which will be read-only, for bug
   #208266.
 
index 5d0a2b0060383595a897bd7adf6ad9dea7f159cc..a9f0918dc833d8f1d3724840bbdc15c467837c1f 100644 (file)
@@ -1,9 +1,9 @@
 #!/bin/ash
 
-PATH=/usr/sbin:/usr/bin:/sbin:/bin
+PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 
 # Default to the udev device manager
-USE_UDEV_NORMAL=1
+USE_UDEV_NORMAL='1'
 
 # Insert ctrl character
 # ctrl-V then esc will print ^[
@@ -15,7 +15,6 @@ BAD="\033[31;1m"
 BOLD="\033[1m"
 GOOD="\033[32;1m"
 
-
 # From KNOPPIX LINUXRC
 # Reset fb color mode
 RESET="\e]R"
@@ -48,7 +47,7 @@ WHITE="\e[1;37m"
 # Just go to the top of the screen
 # echo -n "\e[H\e[J"
 
-KV="`uname -r`"
+KV=`uname -r`
 KMAJOR=`echo $KV | cut -f1 -d.`
 KMINOR=`echo $KV | cut -f2 -d.`
 KVER="${KMAJOR}.${KMINOR}"
@@ -59,7 +58,7 @@ then
        KV_2_6_OR_GREATER="yes"
 fi
 
-QUIET=1
+QUIET='1'
 ROOT_LINKS='bin sbin lib lib32 lib64 boot usr opt emul'
 ROOT_TREES='etc root home var'
 INSMOD='insmod'
@@ -71,11 +70,13 @@ else
 fi
 
 REAL_ROOT=''
-CDROOT=0
+CDROOT='0'
 CDROOT_DEV=''
 CDROOT_TYPE='auto'
-NEW_ROOT="/newroot"
-CONSOLE="/dev/console"
+NEW_ROOT='/newroot'
+CONSOLE='/dev/console'
+
+LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
 
 # Only sections that are in by default or those that
 # are not module groups need to be defined here...
index b802630c908e57e44deff295e4415c36343a519b..beeaa08610fbe7c5cfeb5a32f66a287b16b818a5 100644 (file)
@@ -938,3 +938,21 @@ tuxonice_resume() {
                echo > "${tuxonice_do_resume}"
        fi
 }
+
+find_loop() {
+       CDROM="${NEW_ROOT}/mnt/cdrom"
+       for loop in ${LOOPS}
+       do
+               if [ -e "${CDROM}""${loop}" ]
+               then
+                       LOOP="${loop}"
+               fi
+       done
+}
+
+find_looptype() {
+       LOOPTYPE="${LOOP##*.}"
+       [ "${LOOPTYPE}" == "loop" ] && LOOPTYPE="normal"
+       [ "${LOOP}" == "/zisofs" ] && LOOPTYPE="${LOOP:1}"
+       [ -z "${LOOPTYPE}" ] && LOOPTYPE="noloop"
+}
index 9db2b0af92521183e900dfb2a8e482ba7a7f5f03..0bb75e4159f5bf5d8d0914fb997ea1e1ae039078 100644 (file)
@@ -421,52 +421,9 @@ then
        good_msg 'Determining looptype ...'
        cd "${NEW_ROOT}"
 
-       # Find loop and looptype if we have NFS-mounted a livecd
-       if  [ "${LOOP}" = '' ] && [ "${REAL_ROOT}" = '/dev/nfs' ]
-       then
-               if [ -e "${NEW_ROOT}/mnt/cdrom/livecd.loop" ]; then
-                       LOOP='/livecd.loop'
-                       LOOPTYPE='normal'
-                               elif [ -e "${NEW_ROOT}/mnt/cdrom/zisofs" ]; then
-                       LOOP='/zisofs'
-                       LOOPTYPE='zisofs'
-                               elif [ -e "${NEW_ROOT}/mnt/cdrom/livecd.squashfs" ]; then
-                       LOOP='/livecd.squashfs'
-                       LOOPTYPE='squashfs'
-                               elif [ -e "${NEW_ROOT}/mnt/cdrom/image.squashfs" ]; then
-                       LOOP='/image.squashfs'
-                       LOOPTYPE='squashfs'
-                               elif [ -e "${NEW_ROOT}/mnt/cdrom/livecd.gcloop" ]; then
-                       LOOP='/livecd.gcloop'
-                       LOOPTYPE='gcloop'
-                               else
-                       LOOPTYPE='noloop'
-               fi
-       fi
-
-       # Failsafe the loop type wasn't set
-       if [ "${LOOPTYPE}" = '' ]
-       then
-               warn_msg 'Warning: loop type unspecified!'
-               if [ "${LOOP}" = '/livecd.loop' ]
-               then
-                       LOOPTYPE='normal'
-               elif [ "${LOOP}" = '/zisofs' ]
-               then
-                       LOOPTYPE='zisofs'
-               elif [ "${LOOP}" = '/livecd.squashfs' ]
-               then
-                       LOOPTYPE='squashfs'
-               elif [ "${LOOP}" = '/image.squashfs' ]
-               then
-                       LOOPTYPE='squashfs'
-               elif [ "${LOOP}" = '/livecd.gcloop' ]
-               then
-                       LOOPTYPE='gcloop'
-               else
-                       LOOPTYPE='noloop'
-               fi
-       fi
+       # Find loop and looptype
+       [ -z "${LOOP}" ] && find_loop
+       [ -z "${LOOPTYPE}" ] && find_looptype
 
        cache_cd_contents
 
@@ -490,9 +447,7 @@ then
                                MOUNTTYPE="${LOOPTYPE}"
                                ;;
                esac
-
                mount -t "${MOUNTTYPE}" -o ro /dev/mapper/root "${NEW_ROOT}/mnt/livecd"
-
                test_success 'Mount filesystem'
                FS_LOCATION='mnt/livecd'
        # Setup the loopback mounts, if unencrypted