From d3673f022da3ac97597d0d24a3a998d70af388ce Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Sat, 1 Mar 2025 13:40:31 -0500 Subject: [PATCH] Updated git_bay_number --- driveAtlas.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/driveAtlas.sh b/driveAtlas.sh index 40c44cc..e2502f8 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -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() {