Updated git_bay_number

This commit is contained in:
2025-03-01 13:40:31 -05:00
parent 9877377bbf
commit d3673f022d

View File

@ -34,15 +34,15 @@ get_drives_info() {
get_bay_number() {
local drive=$1
local path=$(readlink -f "/dev/disk/by-path/"*$(basename "$drive"))
local drive_name=$(basename "$drive")
# Extract bay number from the path based on medium2's mapping
for mapping in ${DRIVE_MAPPINGS[medium2]}; do
if [[ $path =~ $mapping ]]; then
echo "${mapping##*:}"
# Search through mappings for this drive
while IFS=: read -r path bay device; do
if [[ "$drive_name" == "$device" ]]; then
echo "$bay"
return
fi
done
done <<< "${DRIVE_MAPPINGS[medium2]}"
}
get_physical_mapping() {