Updated git_bay_number
This commit is contained in:
@ -34,15 +34,15 @@ get_drives_info() {
|
|||||||
|
|
||||||
get_bay_number() {
|
get_bay_number() {
|
||||||
local drive=$1
|
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
|
# Search through mappings for this drive
|
||||||
for mapping in ${DRIVE_MAPPINGS[medium2]}; do
|
while IFS=: read -r path bay device; do
|
||||||
if [[ $path =~ $mapping ]]; then
|
if [[ "$drive_name" == "$device" ]]; then
|
||||||
echo "${mapping##*:}"
|
echo "$bay"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done <<< "${DRIVE_MAPPINGS[medium2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_physical_mapping() {
|
get_physical_mapping() {
|
||||||
|
|||||||
Reference in New Issue
Block a user