Code to mount /usr and other filesystems as needed for new udev and systemd.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
cleanup-cruft
Robin H. Johnson 13 years ago
parent 0c2c1f564e
commit 603a197839

@ -5,6 +5,10 @@
# Distributed under the GPL v2
# $Id$
06 Jan 2012; Robin H. Johnson <robbat2@gentoo.org> defaults/initrd.scripts,
defaults/linuxrc:
Code to mount /usr and other filesystems as needed for new udev and systemd.
06 Jan 2012; Robin H. Johnson <robbat2@gentoo.org> genkernel:
Bump version to 3.4.21.2. Stock configuration of 3.4.21.1 generates
unbootable initramfs!

@ -1178,3 +1178,28 @@ setup_unionfs() {
USE_UNIONFS_NORMAL=0
fi
}
get_mounts_list()
{
awk '
/^[[:blank:]]*#/ { next }
{ print $1 }
' ${NEW_ROOT}/etc/initramfs.mounts
}
get_mount_options()
{
awk -v fs="$1" '
/^[[:blank:]]*#/ { next }
$2 == fs { print $3 }
' ${NEW_ROOT}/etc/fstab
}
get_mount_device()
{
awk -v fs="$1" '
/^[[:blank:]]*#/ { next }
$2 == fs { print $1 }
' ${NEW_ROOT}/etc/fstab
}

@ -701,6 +701,24 @@ else
fi
fi
# Mount the additional things as required by udev & systemd
if [ ! -f ${NEW_ROOT}/etc/initramfs.mounts ]; then
fslist="/usr"
else
fslist=$(get_mounts_list)
fi
for fs in $fslist; do
dev=$(get_mount_device $fs)
# In this case, it's probably part of the filesystem
# and not a mountpoint
[ -z "$dev" ] && continue
opts="ro,$(get_mount_options \"$fs\")"
if ! mount -o ${opts} $dev ${NEW_ROOT}${fs}; then
rescue_shell "Unable to mount $dev on $fs"
fi
done
# Execute script on the cdrom just before boot to update things if necessary
cdupdate
@ -746,10 +764,11 @@ exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}"
# If we get here, something bad has happened
splash 'verbose'
echo 'A fatal error has probably occured since /sbin/init did not'
echo 'boot correctly. Trying to open a shell...'
echo "A fatal error has probably occured since ${REAL_INIT:-/sbin/init} did not"
echo "boot correctly. Trying to open a shell..."
echo
exec /bin/bash
exec /bin/sh
exec /bin/ash
exec /bin/dash
exec sh

Loading…
Cancel
Save