use findmnt with "--source" or "--target"
This avoids hanging on stale NFS mounts, which are not part of the boot process. https://bugzilla.redhat.com/show_bug.cgi?id=975401master
parent
282e0583b0
commit
5e60145449
|
@ -340,7 +340,7 @@ find_block_device() {
|
|||
echo $_dev
|
||||
return 0
|
||||
fi
|
||||
done < <(findmnt -e -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
|
||||
done < <(findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt")
|
||||
fi
|
||||
# fall back to /etc/fstab
|
||||
|
||||
|
@ -362,7 +362,7 @@ find_block_device() {
|
|||
echo $_dev
|
||||
return 0
|
||||
fi
|
||||
done < <(findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
|
||||
done < <(findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt")
|
||||
|
||||
return 1
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ find_mp_fstype() {
|
|||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs
|
||||
return 0
|
||||
done < <(findmnt -e -v -n -o 'FSTYPE' "$1")
|
||||
done < <(findmnt -e -v -n -o 'FSTYPE' --target "$1")
|
||||
fi
|
||||
|
||||
while read _fs; do
|
||||
|
@ -392,7 +392,7 @@ find_mp_fstype() {
|
|||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs
|
||||
return 0
|
||||
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' "$1")
|
||||
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1")
|
||||
|
||||
return 1
|
||||
}
|
||||
|
@ -406,10 +406,28 @@ find_mp_fstype() {
|
|||
# $ find_dev_fstype /dev/sda2;echo
|
||||
# ext4
|
||||
find_dev_fstype() {
|
||||
local _x _mpt _majmin _dev _fs _maj _min _find_dev
|
||||
local _find_dev _fs
|
||||
_find_dev="$1"
|
||||
[[ "$_find_dev" = /dev* ]] || _find_dev="/dev/block/$_find_dev"
|
||||
find_mp_fstype "$_find_dev"
|
||||
|
||||
if [[ $use_fstab != yes ]]; then
|
||||
while read _fs; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs
|
||||
return 0
|
||||
done < <(findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev")
|
||||
fi
|
||||
|
||||
while read _fs; do
|
||||
[[ $_fs ]] || continue
|
||||
[[ $_fs = "autofs" ]] && continue
|
||||
echo -n $_fs
|
||||
return 0
|
||||
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev")
|
||||
|
||||
return 1
|
||||
|
||||
}
|
||||
|
||||
# finds the major:minor of the block device backing the root filesystem.
|
||||
|
|
|
@ -789,7 +789,7 @@ chmod 755 "$initdir"
|
|||
|
||||
if [[ $hostonly ]]; then
|
||||
for i in /sys /proc /run /dev; do
|
||||
if ! findmnt "$i" &>/dev/null; then
|
||||
if ! findmnt --target "$i" &>/dev/null; then
|
||||
dwarning "Turning off host-only mode: '$i' is not mounted!"
|
||||
unset hostonly
|
||||
fi
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
SECURITYFSDIR="/sys/kernel/security"
|
||||
export SECURITYFSDIR
|
||||
|
||||
if ! findmnt "${SECURITYFSDIR}" >/dev/null 2>&1; then
|
||||
if ! findmnt --target "${SECURITYFSDIR}" >/dev/null 2>&1; then
|
||||
mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue