# 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.
#!/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 ^[
BOLD="\033[1m"
GOOD="\033[32;1m"
-
# From KNOPPIX LINUXRC
# Reset fb color mode
RESET="\e]R"
# 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}"
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'
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...
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"
+}
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
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