mirror of
https://github.com/dracutdevs/dracut.git
synced 2024-10-28 10:55:18 +03:00
99base/init, 98usrmount: mount /usr if found in /sysroot/etc/fstab
We cannot boot correctly without /usr, because of http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken so, we mount /usr readonly.
This commit is contained in:
parent
b0692d0311
commit
470ee2d214
@ -257,6 +257,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_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
|
||||
|
16
modules.d/98usrmount/module-setup.sh
Executable file
16
modules.d/98usrmount/module-setup.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/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"
|
||||
}
|
||||
|
32
modules.d/98usrmount/mount-usr.sh
Executable file
32
modules.d/98usrmount/mount-usr.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/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
|
@ -314,33 +314,12 @@ done
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user