livecd fixes
authorBrad House <brad_mssw@gentoo.org>
Sun, 11 Jan 2004 18:39:24 +0000 (18:39 +0000)
committerBrad House <brad_mssw@gentoo.org>
Sun, 11 Jan 2004 18:39:24 +0000 (18:39 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@47 67a159dc-881f-0410-a524-ba9dfbe2cb84

generic/linuxrc

index de97732f4d70eb5b1db2c61e9978b9a624b93d58..03ce3cf3d8140e3980cfa622f4b46b784f78c39f 100644 (file)
@@ -33,6 +33,9 @@ do
                nodevfs)
                        USE_DEVFS_NORMAL=0
                ;;
+               loop\=*)
+                       LOOP=`parse_opt "${x}"`
+               ;;
                *)
                ;;
        esac
@@ -71,14 +74,24 @@ mkdir /newroot
 if [ "${CDROOT}" -eq "1" ]
 then
        mount -t tmpfs tmpfs /newroot
-       mkdir /newroot/dev /newroot/mnt /newroot/mnt/cdrom /newroot/mnt/.init.d /newroot/mnt/gentoo
+       mkdir /newroot/dev /newroot/mnt /newroot/mnt/cdrom /newrot/mnt/loop /newroot/tmp/.initrd /newroot/mnt/gentoo
        [ ! -e /newroot/dev/.devfsd ] && mount -t devfs devfs /newroot/dev
        devfsd /newroot/dev
+       sleep 1
        findcdmount /newroot/dev/cdroms/*
+       # not in /dev/cdroms try /dev/ide/cd
+       if [ "${REAL_ROOT}" = "" ]
+       then
+               findcdmount /newroot/dev/ide/cd/*
+       fi
+
+
        if [ "${REAL_ROOT}" = "" ]
        then
                kill_devfsd
+               sleep 1
                umount /newroot/dev/
+               sleep 1
                umount /newroot
                # shouldn't be anything in here b/c it was on tmpfs
                rm -rf /newroot/*
@@ -152,13 +165,27 @@ if [ "${CDROOT}" = "1" ]
 then
        echo "STEP 5a: filling tmpfs filesystem"
        cd /newroot
+       if [ "${LOOP}" != "" ]
+       then
+               echo "STEP 5a1: mounting loop filesystem"
+               mount -o loop /newroot/mnt/cdrom/${LOOP} /newroot/mnt/loop
+               if [ "$?" != 0 ]
+               then
+                       echo "FAILED TO MOUNT LOOP FILESYSTEM, barfing out to shell"
+                       /bin/ash
+               fi
+               FS_LOCATION="mnt/loop"
+       else
+               FS_LOCATION="mnt/cdrom"
+       fi
+       echo "STEP 5a2: filling filesystem"
        for x in ${ROOT_LINKS}
        do
-               ln -s "mnt/cdrom/${x}" "${x}"
+               ln -s "${FS_LOCATION}/${x}" "${x}"
        done
        mkdir initrd proc tmp sys
        chmod 1777 tmp
-       (cd /newroot/mnt/cdrom; cp -a ${ROOT_TREES} /newroot)
+       (cd /newroot/${FS_LOCATION}; cp -a ${ROOT_TREES} /newroot)
        kill_devfsd
 else
        echo "STEP 5b: setting up stuff for pivot_root"