Fix: Uniquely determine the mount point in GetDevice

This commit is contained in:
The-going
2023-01-20 14:04:06 +03:00
parent bf462f3517
commit fc417f5c29

View File

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