From 7b6b549667c29c77585b38ceeab45502e91a7a5b Mon Sep 17 00:00:00 2001 From: Ing Date: Wed, 7 Aug 2024 01:42:12 +0800 Subject: [PATCH] fix getBus --- files/initrd/opt/rr/include/functions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index 6bdf6755..09be825a 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -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 }