dynamic ascii art med 2
This commit is contained in:
@ -110,35 +110,47 @@ generate_medium2_layout() {
|
||||
local sata_drives=$(ls -l /dev/disk/by-path/pci-0000:0c:00.0-ata-[0-9]$ 2>/dev/null | awk -F'/' '{print $NF}')
|
||||
local nvme_drive=$(ls -l /dev/disk/by-path/pci-0000:0d:00.0* 2>/dev/null | awk -F'/' '{print $NF}')
|
||||
|
||||
# Print USB section
|
||||
# USB Section
|
||||
printf " External USB [0b:00.0]\n"
|
||||
printf " ┌────┐ ┌────┐\n"
|
||||
printf " │%-4s│ │%-4s│\n" "$(echo "$usb_drives" | grep "sdf" || echo "")" "$(echo "$usb_drives" | grep "sde" || echo "")"
|
||||
for drive in sdf sde; do
|
||||
if echo "$usb_drives" | grep -q "$drive"; then
|
||||
local size=$(get_drive_details "$drive")
|
||||
printf " │%-4s│ " "$drive"
|
||||
printf "│%-4s│\n" "$size"
|
||||
fi
|
||||
done
|
||||
printf " └────┘ └────┘\n\n"
|
||||
|
||||
# Main chassis layout
|
||||
printf "┌──────────────────────────────────────────────────────────────┐\n"
|
||||
printf "│ B650D4U3-2Q/BCM │\n"
|
||||
printf "│ │\n"
|
||||
printf "│ NVMe [0d:00.0] │\n"
|
||||
printf "│ ┌────┐ │\n"
|
||||
printf "│ │%-4s│ │\n" "$(echo "$nvme_drive" | cut -c1-4)"
|
||||
if [ -n "$nvme_drive" ]; then
|
||||
local nvme_info=$(get_drive_smart_info "$nvme_drive")
|
||||
printf "│ │%-4s│ │\n" "$nvme_drive"
|
||||
printf "│ │%-4s│ │\n" "$nvme_info"
|
||||
fi
|
||||
printf "│ └────┘ │\n"
|
||||
printf "│ │\n"
|
||||
printf "│ Front Hot-swap Bays [0c:00.0] │\n"
|
||||
|
||||
# Print SATA drive bays
|
||||
# Hot-swap bays
|
||||
printf "│ ┌────┐┌────┐┌────┐┌────┐┌────┐┌────┐┌────┐┌────┐┌────┐┌────┐ │\n"
|
||||
for row in {1..6}; do
|
||||
for row in {1..7}; do
|
||||
printf "│ "
|
||||
for bay in {1..10}; do
|
||||
local drive=$(echo "$sata_drives" | grep "ata-$bay" || echo "")
|
||||
if [ $row -eq 3 ]; then
|
||||
printf "│%-4s│" "$drive"
|
||||
elif [ $row -eq 4 ]; then
|
||||
local drive=$(echo "$sata_drives" | grep "ata-$bay" | cut -d'/' -f3)
|
||||
if [ $row -eq 4 ]; then
|
||||
printf "│ %-3d │" "$bay"
|
||||
elif [ -n "$drive" ] && [ $row -eq 5 ]; then
|
||||
local size=$(get_drive_details "$drive")
|
||||
printf "│%-4s│" "$size"
|
||||
elif [ -n "$drive" ]; then
|
||||
case $row in
|
||||
2) local info=$(get_drive_smart_info "$drive"); printf "│%-4s│" "${info%%|*}" ;;
|
||||
3) local size=$(get_drive_details "$drive"); printf "│%-4s│" "$size" ;;
|
||||
*) printf "│ │" ;;
|
||||
esac
|
||||
else
|
||||
printf "│ │"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user