mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-24 00:49:52 +07:00
arc-functions: rework sysinfo
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
fe642ebec2
commit
6b315e08ad
@ -1089,67 +1089,69 @@ function sysinfo() {
|
||||
TEXT+="\n Ports with color \Z1\Zbred\Zn as DUMMY, color \Z2\Zbgreen\Zn has a Disk connected.\n"
|
||||
done
|
||||
fi
|
||||
if [ $(lspci -d ::107 | wc -l) -gt 0 ]; then
|
||||
TEXT+="\n SAS Controller:\n"
|
||||
for PCI in $(lspci -d ::107 | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
|
||||
[ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ] && TEXT+="\n RAID Controller:\n"
|
||||
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
fi
|
||||
if [ $(lspci -d ::104 | wc -l) -gt 0 ]; then
|
||||
TEXT+="\n Raid Controller:\n"
|
||||
for PCI in $(lspci -d ::104 | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
|
||||
[ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ] && TEXT+="\nHBA Controller:\n"
|
||||
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
fi
|
||||
if [ $(lspci -d ::100 | wc -l) -gt 0 ]; then
|
||||
TEXT+="\n SCSI Controller:\n"
|
||||
for PCI in $(lspci -d ::100 | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
fi
|
||||
if [[ -d "/sys/class/scsi_host" && $(ls -l /sys/class/scsi_host | grep usb | wc -l) -gt 0 ]]; then
|
||||
TEXT+="\n USB Controller:\n"
|
||||
for PCI in $(lspci -d ::c03 | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
|
||||
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
[ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ] && TEXT+="\n SCSI Controller:\n"
|
||||
for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORTNUM=$(ls -l /sys/block/* 2>/dev/null | grep "${PCI}" | wc -l)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
fi
|
||||
if [[ -d "/sys/class/mmc_host" && $(ls -l /sys/class/mmc_host | grep mmc_host | wc -l) -gt 0 ]]; then
|
||||
TEXT+="\n MMC Controller:\n"
|
||||
for PCI in $(lspci -d ::805 | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
|
||||
PORTNUM=$(ls -l /sys/class/mmc_host | grep "${PCI}" | wc -l)
|
||||
PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l)
|
||||
[ $(lspci -d ::101 2>/dev/null | wc -l) -gt 0 ] && TEXT+="\n IDE Controller:\n"
|
||||
for PCI in $(lspci -d ::101 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORTNUM=$(ls -l /sys/block/* 2>/dev/null | grep "${PCI}" | wc -l)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
fi
|
||||
if [ $(lspci -d ::108 | wc -l) -gt 0 ]; then
|
||||
TEXT+="\n NVMe Controller:\n"
|
||||
for PCI in $(lspci -d ::108 | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" | sed "s/\ .*://" | awk '{$1=""}1' | awk '{$1=$1};1')
|
||||
PORT=$(ls -l /sys/class/nvme | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b | grep -v - | grep "\[N:${PORT}:" | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\n Disks: ${PORTNUM}\n"
|
||||
[ $(ls -l /sys/class/scsi_host 2>/dev/null | grep usb | wc -l) -gt 0 ] && TEXT+="\n USB Controller:\n"
|
||||
for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORT=$(ls -l /sys/class/scsi_host 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[${PORT}:" | wc -l)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
[ $(ls -l /sys/class/mmc_host 2>/dev/null | grep mmc_host | wc -l) -gt 0 ] && TEXT+="\n MMC Controller:\n"
|
||||
for PCI in $(lspci -d ::805 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORTNUM=$(ls -l /sys/block/mmc* 2>/dev/null | grep "${PCI}" | wc -l)
|
||||
[ ${PORTNUM} -eq 0 ] && continue
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
[ $(lspci -d ::108 2>/dev/null | wc -l) -gt 0 ] && TEXT+="\n NVME Controller:\n"
|
||||
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
|
||||
NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://")
|
||||
PORT=$(ls -l /sys/class/nvme 2>/dev/null | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n)
|
||||
PORTNUM=$(lsscsi -b 2>/dev/null | grep -v - | grep "\[N:${PORT}:" | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
done
|
||||
if [ $(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep 'vmbus:acpi' | wc -l) -gt 0 ]; then
|
||||
TEXT+="\n VMBUS Controller:\n"
|
||||
NAME="vmbus:acpi"
|
||||
PORTNUM=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep 'vmbus:acpi' | wc -l)
|
||||
TEXT+="\Zb ${NAME}\Zn\nNumber: ${PORTNUM}\n"
|
||||
NUMPORTS=$((${NUMPORTS} + ${PORTNUM}))
|
||||
fi
|
||||
TEXT+="\n Total Disks: \Zb${NUMPORTS}\Zn"
|
||||
[ -f "${TMP_PATH}/diag" ] && rm -f "${TMP_PATH}/diag" >/dev/null
|
||||
|
Loading…
Reference in New Issue
Block a user