From 603a1978393aaf4e872dbcf0691a8272e0a3dc5d Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Fri, 6 Jan 2012 04:18:37 +0000 Subject: [PATCH] Code to mount /usr and other filesystems as needed for new udev and systemd. Signed-off-by: Robin H. Johnson --- ChangeLog | 4 ++++ defaults/initrd.scripts | 25 +++++++++++++++++++++++++ defaults/linuxrc | 23 +++++++++++++++++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48843ec..01598db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ # Distributed under the GPL v2 # $Id$ + 06 Jan 2012; Robin H. Johnson 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 genkernel: Bump version to 3.4.21.2. Stock configuration of 3.4.21.1 generates unbootable initramfs! diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index b7b42ab..89629e9 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -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 +} + diff --git a/defaults/linuxrc b/defaults/linuxrc index 28d204e..599c0d1 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -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 -- 2.26.2