Skip to content

Commit

Permalink
fix getBus
Browse files Browse the repository at this point in the history
  • Loading branch information
wjz304 committed Aug 6, 2024
1 parent f28d268 commit 7b6b549
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions files/initrd/opt/rr/include/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ function _sort_netif() {
function getBus() {
local BUS=""
# usb/ata(ide)/sata/sas/virtio/mmc/nvme
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,TRAN 2>/dev/null | grep "${1} " | awk '{print $2}' | sed 's/ata/ide/') #Spaces are intentional
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,TRAN 2>/dev/null | grep "${1} " | awk '{print $2}' | sed 's/^ata$/ide/') #Spaces are intentional
# usb/scsi(ide/sata/sas)/virtio/mmc/nvme/vmbus/xen(xvd)
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk '{print $2}' | awk -F':' '{print $(NF-1)}' | sed 's/_host//' | sed 's/.*xen.*/xen/') # Spaces are intentional
[ -z "${BUS}" ] && "UNKNOWN"
[ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk '{print $2}' | awk -F':' '{print $(NF-1)}' | sed 's/_host//' | sed 's/^.*xen.*$/xen/') # Spaces are intentional
[ -z "${BUS}" ] && BUS="unknown"
echo "${BUS}"
return 0
}
Expand Down

0 comments on commit 7b6b549

Please sign in to comment.