windows: vista 从镜像获取默认密钥

This commit is contained in:
bin456789 2025-05-16 19:06:08 +08:00
parent 19198a6146
commit 6a57249015
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -6449,14 +6449,14 @@ EOF
# key
if [ "$product_ver" = vista ]; then
# vista 需密钥,密钥可与 edition 不一致
# TODO: 改成从网页获取?
# vista 无人值守安装需要密钥,密钥可与 edition 不一致
# https://learn.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys
key=VKK3X-68KWM-X2YGT-QR4M6-4BWMV
# 从镜像获取默认密钥
setup_cfg=$(get_path_in_correct_case /os/installer/sources/inf/setup.cfg)
key=$(del_cr <"$setup_cfg" | grep -Eix 'Value=([A-Z0-9]{5}-){4}[A-Z0-9]{5}' | cut -d= -f2 | grep .)
sed -i "s/%key%/$key/" /tmp/autounattend.xml
else
# shellcheck disable=SC2010
if ls -d /os/installer/sources/* | grep -iq ei.cfg; then
if [ -f "$(get_path_in_correct_case /os/installer/sources/ei.cfg)" ]; then
# 镜像有 ei.cfg删除 key 字段
sed -i "/%key%/d" /tmp/autounattend.xml
else