windows: 更准确地识别镜像系统版本

This commit is contained in:
bin456789
2026-05-20 21:25:30 +08:00
parent 8d099f167f
commit 87301108df

View File

@ -5681,49 +5681,58 @@ get_aws_repo() {
fi fi
} }
get_client_name_by_build_ver() {
build_ver=$1
if [ "$build_ver" -ge 22000 ]; then
echo 11
elif [ "$build_ver" -ge 10240 ]; then
echo 10
elif [ "$build_ver" -ge 9600 ]; then
echo 8.1
elif [ "$build_ver" -ge 9200 ]; then
echo 8
elif [ "$build_ver" -ge 7600 ]; then
echo 7
elif [ "$build_ver" -ge 6000 ]; then
echo vista
else
error_and_exit "Unknown Build Version: $build_ver"
fi
}
# 将 AC/SAC 版本号 转换为 LTSC 版本号 # 将 AC/SAC 版本号 转换为 LTSC 版本号
# 用于查找驱动 # 用于查找驱动
get_server_name_by_build_ver() { get_windows_name_by_version() {
build_ver=$1 local nt_ver=$1
local build_ver=$2
local windows_type=$3
if [ "$build_ver" -ge 26100 ]; then local windows_name
echo 2025 windows_name=$(
elif [ "$build_ver" -ge 20348 ]; then case "$windows_type" in
echo 2022 client)
elif [ "$build_ver" -ge 17763 ]; then case "$nt_ver" in
echo 2019 10.0)
elif [ "$build_ver" -ge 14393 ]; then if [ "$build_ver" -ge 22000 ]; then
echo 2016 echo 11
elif [ "$build_ver" -ge 9600 ]; then else
echo 2012 r2 echo 10
elif [ "$build_ver" -ge 9200 ]; then fi
echo 2012 ;;
elif [ "$build_ver" -ge 7600 ]; then 6.3) echo 8.1 ;;
echo 2008 r2 6.2) echo 8 ;;
elif [ "$build_ver" -ge 6001 ]; then 6.1) echo 7 ;;
echo 2008 6.0) echo vista ;;
esac
;;
server)
case "$nt_ver" in
10.0)
if [ "$build_ver" -ge 26100 ]; then
echo 2025
elif [ "$build_ver" -ge 20348 ]; then
echo 2022
elif [ "$build_ver" -ge 17763 ]; then
echo 2019
else
echo 2016
fi
;;
6.3) echo '2012 r2' ;;
6.2) echo '2012' ;;
6.1) echo '2008 r2' ;;
6.0) echo '2008' ;;
esac
;;
esac
)
if [ -n "$windows_name" ]; then
echo "$windows_name"
else else
error_and_exit "Unknown Build Version: $build_ver" error_and_exit "Unknown Windows Version: $nt_ver $build_ver $windows_type"
fi fi
} }
@ -6032,12 +6041,7 @@ install_windows() {
# 检测 client/server并转换成标准版 windows 名称 # 检测 client/server并转换成标准版 windows 名称
# 用于将 Hyper-V Server / Azure Stack HCI / Windows Server AC 的版本号转换成对应的 LTSC 版本号,用于查找驱动 # 用于将 Hyper-V Server / Azure Stack HCI / Windows Server AC 的版本号转换成对应的 LTSC 版本号,用于查找驱动
windows_type=$(get_windows_type_from_windows_drive /wim) windows_type=$(get_windows_type_from_windows_drive /wim)
product_ver=$( product_ver=$(get_windows_name_by_version "$nt_ver" "$build_ver" "$windows_type")
case "$windows_type" in
client) get_client_name_by_build_ver "$build_ver" ;;
server) get_server_name_by_build_ver "$build_ver" ;;
esac
)
# 检测 sac 和 nvme # 检测 sac 和 nvme
{ {