From 4e5d03a7aeb73c5cb1522e49878bea34780a3448 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sat, 19 Oct 2024 17:27:17 +0800 Subject: [PATCH] =?UTF-8?q?windows:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=20aws=20?= =?UTF-8?q?nirto=20=E6=9C=BA=E5=99=A8=E4=B8=8A=E4=B9=9F=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E4=BA=86=20virtio=20=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trans.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trans.sh b/trans.sh index 2cd5f8c..3b608e3 100644 --- a/trans.sh +++ b/trans.sh @@ -437,13 +437,13 @@ cache_dmi_and_virt() { _virt=$( virt-what - # hyper-v 环境下 modprobe virtio_scsi 也会创建 /sys/bus/virtio/drivers - # 因此用 devices 判断更准确,有设备时才有 devices + # hyper-v 环境下 modprobe virtio_scsi 也会创建 /sys/bus/virtio/drivers/virtio_scsi + # 因此用 devices 判断更准确,有设备时才有 /sys/bus/virtio/drivers/* # 或者加上 lspci 检测? - # 不要用 [ -d /sys/bus/virtio/devices ] && echo virtio - # 因为非 virtio 时返回值不为 0 - if [ -d /sys/bus/virtio/devices ]; then + # 不要用 ls /sys/bus/virtio/devices/* && echo virtio + # 因为有可能返回值不为 0 而中断脚本 + if ls /sys/bus/virtio/devices/* >/dev/null 2>&1; then echo virtio fi )