From 6c4ed1b97a2ade49aaf413ef056a33d7ffa66ea9 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Fri, 26 Jan 2024 20:57:12 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E6=A0=B9=E6=8D=AE=E9=A3=8E=E6=89=87?= =?UTF-8?q?=E5=92=8C=E6=B8=A9=E5=BA=A6=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E5=90=A6=E8=99=9A=E6=8B=9F=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reinstall.sh b/reinstall.sh index a5a8326..a754a1e 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -258,15 +258,17 @@ is_virt() { # https://sources.debian.org/src/hw-detect/1.159/hw-detect.finish-install.d/08hw-detect/ vmstr='VMware|Virtual|Virtualization|VirtualBox|VMW|Hyper-V|Bochs|QEMU|KVM|OpenStack|KubeVirt|innotek|Xen|Parallels|BHYVE' for name in ComputerSystem BIOS BaseBoard; do - if wmic $name | grep -Eiwo $vmstr; then + if wmic $name get /format:list | grep -Eiw $vmstr; then _is_virt=true break fi done - if [ -z "$_is_virt" ]; then - if wmic /namespace:'\\root\cimv2' PATH Win32_Fan 2>/dev/null | head -1 | grep -q Name; then - _is_virt=false - fi + + # 没有风扇和温度信息,大概是虚拟机 + if [ -z "$_is_virt" ] && + ! wmic /namespace:'\\root\cimv2' PATH Win32_Fan 2>/dev/null | grep -q Name && + ! wmic /namespace:'\\root\wmi' PATH MSAcpi_ThermalZoneTemperature 2>/dev/null | grep -q Name; then + _is_virt=true fi else # aws t4g debian 11