You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.6 KiB

#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-lib.sh
filter_rootopts() {
rootopts=$1
# strip ro and rw options
15 years ago
local OLDIFS="$IFS"
IFS=,
set -- $rootopts
15 years ago
IFS="$OLDIFS"
local v
while [ $# -gt 0 ]; do
case $1 in
rw|ro);;
defaults);;
*)
v="$v,${1}";;
esac
shift
done
rootopts=${v#,}
echo $rootopts
}
if [ -n "$root" -a -z "${root%%block:*}" ]; then
mount -t ${fstype:-auto} -o "$rflags" "${root#block:}" "$NEWROOT" \
&& ROOTFS_MOUNTED=yes
if getargbool 1 rd.fstab -n rd_NO_FSTAB \
&& ! getarg rootflags \
&& [ -f "$NEWROOT/etc/fstab" ] \
&& ! [ -L "$NEWROOT/etc/fstab" ]; then
# if $NEWROOT/etc/fstab contains special mount options for
# the root filesystem,
# remount it with the proper options
rootfs="auto"
rootopts="defaults"
while read dev mp fs opts rest; do
# skip comments
[ "${dev%%#*}" != "$dev" ] && continue
if [ "$mp" = "/" ]; then
rootfs=$fs
rootopts=$opts
break
fi
done < "$NEWROOT/etc/fstab"
rootopts=$(filter_rootopts $rootopts)
if [ -n "$rootopts" ]; then
umount $NEWROOT
info "Remounting ${root#block:} with -o $rootopts,$rflags"
mount -t "$rootfs" -o "$rflags","$rootopts" \
"${root#block:}" "$NEWROOT" 2>&1 | vinfo
fi
fi
fi