From 81081873dff2ceebd66872ad17591255453b951a Mon Sep 17 00:00:00 2001 From: bin456789 Date: Fri, 13 Feb 2026 00:03:36 +0800 Subject: [PATCH] =?UTF-8?q?windows:=20=E6=9F=A5=E6=89=BE=E5=88=B0=E7=9A=84?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=98=AF=20/=20=E5=BC=80=E5=A4=B4=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=A1=A5=E5=85=A8=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/reinstall.sh b/reinstall.sh index c01da78..a3f15ea 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -305,6 +305,10 @@ get_host_by_url() { cut -d/ -f3 <<<$1 } +get_scheme_and_host_by_url() { + cut -d/ -f1-3 <<<$1 +} + get_function() { declare -f "$1" } @@ -1095,10 +1099,17 @@ get_windows_iso_link() { if [ -n "$label_msdl" ]; then iso=$(curl -L "$page_url" | grep -ioP 'https://[^ ]+?#[0-9]+' | head -1 | grep .) else + http_to_host=$(get_scheme_and_host_by_url "$page_url") + http_to_current_dir=$(dirname "$page_url") curl -L "$page_url" | - tr -d '\n' | sed -e 's,,\n,g' | # 使每个 占一行 - grep -Ei '\.(iso|img)$' | # 找出是 iso 或 img 的行 - sed -E 's,(.+),\2 \1,' >$tmp/win.list # 提取文件名和链接 + tr -d '\n' | sed -e 's,,\n,g' | # 使每个 占一行 + grep -Ei '\.(iso|img)$' | # 找出是 iso 或 img 的行 + # 提取文件名和链接 + # 如果链接是 / 开头,则补全域名 + # 如果链接非 https:// 开头,则补全域名和目录 + sed -E -e 's,(.+),\2 \1,' \ + -e "s, (/), $http_to_host\1," | + awk '{if ($2 !~ /^https?:\/\//) $2 = "'$http_to_current_dir/'" $2; print}' >$tmp/win.list # 如果不是 ltsc ,应该先去除 ltsc 链接,否则最终链接有 ltsc 的 # 例如查找 windows 10 iot enterprise,会得到