Switch to detection for LOOP and LOOPTYPE when they are not set.

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@597 67a159dc-881f-0410-a524-ba9dfbe2cb84
cleanup-cruft
Chris Gianelloni 17 years ago
parent 5b462be907
commit ad4cd03394

@ -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.

@ -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="]R"
@ -48,7 +47,7 @@ WHITE=""
# Just go to the top of the screen
# echo -n ""
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...

@ -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"
}

@ -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

Loading…
Cancel
Save