Fix: Uniquely determine the mount point in GetDevice

This commit is contained in:
The-going 2023-01-19 14:06:04 +03:00
parent 06dda19cb0
commit 6328fdf5c7

View File

@ -1039,13 +1039,10 @@ ShowDeviceWarning() {
} # ShowDeviceWarning
GetDevice() {
TestPath=$(findmnt --noheadings --output SOURCE,FSTYPE "$1" --uniq)
if [[ -z ${TestPath} ]]; then
[[ -n "${1%/*}" ]] \
&& GetDevice "${1%/*}" \
|| GetDevice "/"
else
if TestPath=$(findmnt --noheadings --output SOURCE,FSTYPE --target "$1" --uniq); then
echo "${TestPath}"
else
echo "Bud Path: $1" >&2; exit 1
fi
} # GetDevice