mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-31 19:08:07 +08:00
core: 改善 vm 检测
This commit is contained in:
parent
9dfc148295
commit
69f2bd2e58
14
reinstall.sh
14
reinstall.sh
@ -102,12 +102,16 @@ is_virt() {
|
|||||||
done
|
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
|
# aws t4g debian 11 systemd-detect-virt 为 none,即使装了dmidecode
|
||||||
systemd-detect-virt
|
# virt-what: 未装 deidecode时结果为空,装了deidecode后结果为aws
|
||||||
else
|
# 所以综合两个命令的结果来判断
|
||||||
install_pkg virt-what
|
if command -v systemd-detect-virt && systemd-detect-virt; then
|
||||||
virt-what
|
return 0
|
||||||
fi
|
fi
|
||||||
|
# debian 安装 virt-what 不会自动安装 dmidecode,因此结果有误
|
||||||
|
install_pkg dmidecode virt-what
|
||||||
|
# virt-what 返回值始终是0,所以用是否有输出作为判断
|
||||||
|
[ -n "$(virt-what)" ]
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user