From 6a57249015beebcd31584cc9098fad2952109222 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Fri, 16 May 2025 19:06:08 +0800 Subject: [PATCH] =?UTF-8?q?windows:=20vista=20=E4=BB=8E=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=BB=98=E8=AE=A4=E5=AF=86=E9=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trans.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trans.sh b/trans.sh index a324061..e588682 100644 --- a/trans.sh +++ b/trans.sh @@ -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