%{_datadir}/dracut/modules.d/98integrity
%{_datadir}/dracut/modules.d/98selinux
%{_datadir}/dracut/modules.d/98syslog
+%{_datadir}/dracut/modules.d/98usrmount
%{_datadir}/dracut/modules.d/99base
%{_datadir}/dracut/modules.d/99fs-lib
%{_datadir}/dracut/modules.d/99shutdown
--- /dev/null
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+ return 0
+}
+
+depends() {
+ return 0
+}
+
+install() {
+ inst_hook pre-pivot 50 "$moddir/mount-usr.sh"
+}
+
--- /dev/null
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+type info >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type fsck_single >/dev/null 2>&1 || . /lib/fs-lib.sh
+
+mount_usr()
+{
+ local _dev _mp _fs _opts _rest _usr_found _ret
+ # check, if we have to mount the /usr filesystem
+ while read _dev _mp _fs _opts _rest; do
+ if [ "$_mp" = "/usr" ]; then
+ echo "$_dev $NEWROOT/$_mp $_fs ${_opts},ro $_rest"
+ _usr_found="1"
+ break
+ fi
+ done < "$NEWROOT/etc/fstab" >> /etc/fstab
+
+ if [ "x$__usr_found" != "x" ]; then
+ # we have to mount /usr
+ fsck_single "$_dev" "$_fs" "$_opts"
+ _ret=$?
+ echo $_ret >/run/initramfs/usr-fsck
+ if [ $_ret -ne 255 ]; then
+ info "Mounting /usr"
+ mount "$NEWROOT/usr" 2>&1 | vinfo
+ fi
+ fi
+}
+
+mount_usr
\ No newline at end of file
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
source_hook pre-pivot
-# by the time we get here, the root filesystem should be mounted.
-# Try to find init and mount /usr, if needed to access init.
-unset __usr_found
+# By the time we get here, the root filesystem should be mounted.
+# Try to find init.
for i in "$(getarg real_init=)" "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
[ -n "$i" ] || continue
- __p=$(readlink -m "$NEWROOT$i")
- if [ -n "$__p" ] \
- && [ "x$__usr_found" = "x" ] \
- && [ ! -x "$__p" ] \
- && strstr "$__p" "$NEWROOT/usr" \
- ; then
- # we have to mount /usr
- while read dev mp fs opts rest; do
- if [ "$mp" = "/usr" ]; then
- echo "$dev $NEWROOT$mp $fs ${opts},ro $rest"
- __usr_found="1"
- break
- fi
- done < "$NEWROOT/etc/fstab" >> /etc/fstab
- if [ "x$__usr_found" != "x" ]; then
- info "Mounting /usr"
- mount "$NEWROOT/usr" 2>&1 | vinfo
- fi
- fi
-
- __p=$(readlink -f "$NEWROOT$i")
+ __p=$(readlink -f "${NEWROOT}/${i}")
if [ -x "$__p" ]; then
INIT="$i"
break