From 69f2bd2e5866fb5d429b2b25db8d3d5f1220bf3a Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sat, 8 Jul 2023 17:10:30 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E6=94=B9=E5=96=84=20vm=20=E6=A3=80?= =?UTF-8?q?=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/reinstall.sh b/reinstall.sh index a1bf31d..e1b0fbf 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -102,12 +102,16 @@ is_virt() { done wmic /namespace:'\\root\cimv2' PATH Win32_Fan | head -1 | grep -q -v Name else - if command -v systemd-detect-virt; then - systemd-detect-virt - else - install_pkg virt-what - virt-what + # aws t4g debian 11 systemd-detect-virt 为 none,即使装了dmidecode + # virt-what: 未装 deidecode时结果为空,装了deidecode后结果为aws + # 所以综合两个命令的结果来判断 + if command -v systemd-detect-virt && systemd-detect-virt; then + return 0 fi + # debian 安装 virt-what 不会自动安装 dmidecode,因此结果有误 + install_pkg dmidecode virt-what + # virt-what 返回值始终是0,所以用是否有输出作为判断 + [ -n "$(virt-what)" ] fi }