From ef6c5f7aec8aad5063bfbf55091ef4c98cf9c833 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Fri, 23 Jun 2023 17:52:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8windows=E4=B8=8B=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reinstall.sh b/reinstall.sh index 1836801..f472037 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -92,9 +92,12 @@ add_community_repo_for_alpine() { is_virt() { if is_in_windows; then - vmstr='VMware|Virtual|BOCHS|QEMU' - wmic ComputerSystem | grep -Eiw $vmstr && return 0 - wmic bios | grep -Eiw $vmstr && return 0 + # https://github.com/systemd/systemd/blob/main/src/basic/virt.c + # 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 + wmic $name | grep -Eiw $vmstr && return 0 + done wmic /namespace:'\\root\cimv2' PATH Win32_Fan | head -1 | grep -q -v Name else if command -v systemd-detect-virt; then