# 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!
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
+}
+
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
# 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