Updated git_bay_number
This commit is contained in:
@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user