diff --git a/driveAtlas.sh b/driveAtlas.sh index 48b05ae..3f7be16 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -22,6 +22,13 @@ generate_10bay_layout() { printf "│ %-126s │\n" "$hostname - Sliger CX4712 (10x 3.5\" Hot-swap)" printf "│ │\n" + # Show storage controllers + printf "│ Storage Controllers: │\n" + while IFS= read -r ctrl; do + [[ -n "$ctrl" ]] && printf "│ %-126s│\n" "$ctrl" + done < <(get_storage_controllers) + printf "│ │\n" + # M.2 NVMe slot if present if [[ -n "${DRIVE_MAP[m2-1]}" ]]; then printf "│ M.2 NVMe: %-10s │\n" "${DRIVE_MAP[m2-1]}" @@ -68,6 +75,11 @@ generate_micro_layout() { printf "┌─────────────────────────────────────────────────────────────┐\n" printf "│ %-57s │\n" "$hostname - Micro SBC" printf "│ │\n" + printf "│ Storage Controllers: │\n" + while IFS= read -r ctrl; do + [[ -n "$ctrl" ]] && printf "│ %-57s│\n" "$ctrl" + done < <(get_storage_controllers) + printf "│ │\n" # Show eMMC if present if [[ -n "$emmc_device" ]]; then @@ -94,6 +106,11 @@ generate_large1_layout() { printf "┌─────────────────────────────────────────────────────────────────────────┐\n" printf "│ %-69s │\n" "$hostname - Rosewill RSV-L4500U (15x 3.5\" Bays)" printf "│ │\n" + printf "│ Storage Controllers: │\n" + while IFS= read -r ctrl; do + [[ -n "$ctrl" ]] && printf "│ %-69s│\n" "$ctrl" + done < <(get_storage_controllers) + printf "│ │\n" printf "│ M.2 NVMe: M1: %-10s M2: %-10s │\n" "${DRIVE_MAP[m2-1]:-EMPTY}" "${DRIVE_MAP[m2-2]:-EMPTY}" printf "│ │\n" printf "│ Front Bays (3 stacks x 5 rows): [Bay mapping TBD] │\n" @@ -216,6 +233,16 @@ declare -A CHASSIS_TYPES=( # Core Functions #------------------------------------------------------------------------------ +get_storage_controllers() { + # Returns a formatted list of storage controllers (HBAs, SATA, NVMe) + lspci 2>/dev/null | grep -iE "SAS|SATA|RAID|Mass storage|NVMe" | while read -r line; do + pci_addr=$(echo "$line" | awk '{print $1}') + # Get short description (strip PCI address) + desc=$(echo "$line" | sed 's/^[0-9a-f:.]\+ //') + echo " $pci_addr: $desc" + done +} + build_drive_map() { local host=$(hostname) declare -A drive_map