linuxrc: move livecd initialization code to livecd_init()

master
Fabio Erculiani 12 years ago
parent 3bb6c62bd9
commit 86967ea400

@ -1550,6 +1550,63 @@ setup_squashfs_aufs() {
mount --bind "${CDROOT_PATH}" "${new_cdroot}" mount --bind "${CDROOT_PATH}" "${new_cdroot}"
} }
livecd_init() {
good_msg "Making tmpfs for ${NEW_ROOT}"
mount -n -t tmpfs tmpfs "${NEW_ROOT}"
local dirs=
dirs="dev mnt proc run sys tmp mnt/livecd"
dirs="${dirs} mnt/key tmp/.initrd mnt/gentoo"
for i in ${dirs}; do
mkdir -p "${NEW_ROOT}/${i}"
chmod 755 "${NEW_ROOT}/${i}"
done
[ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}"
[ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
[ ! -e "${NEW_ROOT}/dev/console" ] && \
mknod "${NEW_ROOT}"/dev/console c 5 1
# For SGI LiveCDs ...
if [ "${LOOPTYPE}" = "sgimips" ]; then
[ ! -e "${NEW_ROOT}/dev/sr0" ] && \
mknod "${NEW_ROOT}/dev/sr0" b 11 0
[ ! -e "${NEW_ROOT}/dev/loop0" ] && \
mknod "${NEW_ROOT}/dev/loop0" b 7 0
fi
# Required for splash to work. Not an issue with the initrd as this
# device isn't created there and is not needed.
if [ -e /dev/tty1 ]; then
[ ! -e "${NEW_ROOT}/dev/tty1" ] && \
mknod "${NEW_ROOT}/dev/tty1" c 4 1
fi
if [ "${REAL_ROOT}" != "/dev/nfs" ] && \
[ "${LOOPTYPE}" != "sgimips" ]; then
bootstrap_cd
fi
if [ "${REAL_ROOT}" = '' ]
then
warn_msg "No bootable medium found. Waiting for new devices..."
COUNTER=0
while [ ${COUNTER} -lt 3 ]; do
sleep 3
let COUNTER=${COUNTER}+1
done
sleep 1
bootstrap_cd
fi
if [ "${REAL_ROOT}" = '' ]
then
# leave stale mounts around, make possible to debug
bad_msg 'Could not find CD to boot, something else needed!'
CDROOT=0
fi
}
get_mounts_list() { get_mounts_list() {
awk ' awk '
/^[[:blank:]]*#/ { next } /^[[:blank:]]*#/ { next }

@ -292,65 +292,8 @@ CHROOT="${NEW_ROOT}"
# Run debug shell if requested # Run debug shell if requested
rundebugshell "before setting up the root filesystem" rundebugshell "before setting up the root filesystem"
if is_livecd # Setup Live system mounts
then is_livecd && livecd_init
good_msg "Making tmpfs for ${NEW_ROOT}"
mount -n -t tmpfs tmpfs "${NEW_ROOT}"
for i in dev mnt proc run sys tmp mnt/livecd mnt/key tmp/.initrd mnt/gentoo
do
mkdir -p "${NEW_ROOT}/${i}"
chmod 755 "${NEW_ROOT}/${i}"
done
[ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}"
[ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
[ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
# For SGI LiveCDs ...
if [ "${LOOPTYPE}" = "sgimips" ]
then
[ ! -e "${NEW_ROOT}/dev/sr0" ] && mknod "${NEW_ROOT}/dev/sr0" b 11 0
[ ! -e "${NEW_ROOT}/dev/loop0" ] && mknod "${NEW_ROOT}/dev/loop0" b 7 0
fi
# Required for splash to work. Not an issue with the initrd as this
# device isn't created there and is not needed.
if [ -e /dev/tty1 ]
then
[ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
fi
if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
then
bootstrap_cd
fi
if [ "${REAL_ROOT}" = '' ]
then
warn_msg "No bootable medium found. Waiting for new devices..."
COUNTER=0
while [ ${COUNTER} -lt 3 ]; do
sleep 3
let COUNTER=${COUNTER}+1
done
sleep 1
bootstrap_cd
fi
if [ "${REAL_ROOT}" = '' ]
then
# Undo stuff
umount "${NEW_ROOT}/dev" 2>/dev/null
umount "${NEW_ROOT}/sys" 2>/dev/null
umount /sys 2>/dev/null
umount "${NEW_ROOT}"
rm -rf "${NEW_ROOT}/*"
bad_msg 'Could not find CD to boot, something else needed!'
CDROOT=0
fi
fi
# Determine root device # Determine root device
good_msg 'Determining root device...' good_msg 'Determining root device...'

Loading…
Cancel
Save