mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-31 19:08:07 +08:00
在windows下识别更多虚拟机
This commit is contained in:
parent
09b3111d2b
commit
ef6c5f7aec
@ -92,9 +92,12 @@ add_community_repo_for_alpine() {
|
|||||||
|
|
||||||
is_virt() {
|
is_virt() {
|
||||||
if is_in_windows; then
|
if is_in_windows; then
|
||||||
vmstr='VMware|Virtual|BOCHS|QEMU'
|
# https://github.com/systemd/systemd/blob/main/src/basic/virt.c
|
||||||
wmic ComputerSystem | grep -Eiw $vmstr && return 0
|
# https://sources.debian.org/src/hw-detect/1.159/hw-detect.finish-install.d/08hw-detect/
|
||||||
wmic bios | grep -Eiw $vmstr && return 0
|
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
|
wmic /namespace:'\\root\cimv2' PATH Win32_Fan | head -1 | grep -q -v Name
|
||||||
else
|
else
|
||||||
if command -v systemd-detect-virt; then
|
if command -v systemd-detect-virt; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user