mirror of
https://github.com/bin456789/reinstall.git
synced 2026-02-04 17:14:17 +08:00
77
reinstall.sh
77
reinstall.sh
@ -1358,50 +1358,55 @@ Continue?
|
||||
# 注意 windows server 2008 r2 serverdatacenter 不用改
|
||||
image_name=${image_name/windows server 2008 server/windows longhorn server}
|
||||
|
||||
iso_filetype='iso raw'
|
||||
iso_tested=false
|
||||
if [[ "$iso" = magnet:* ]]; then
|
||||
: # 不测试磁力链接
|
||||
else
|
||||
iso_filetype='iso raw'
|
||||
iso_tested=false
|
||||
|
||||
# 获取 massgrave.dev 直链
|
||||
if grep -Eiq '\.massgrave\.dev/.*\.(iso|img)' <<<"$iso"; then
|
||||
# 如果已经是 iso 直链则跳过下面的 iso 测试
|
||||
if test_url_grace "$iso" "$iso_filetype"; then
|
||||
iso_tested=true
|
||||
# 获取 massgrave.dev 直链
|
||||
if grep -Eiq '\.massgrave\.dev/.*\.(iso|img)' <<<"$iso"; then
|
||||
# 如果已经是 iso 直链则跳过下面的 iso 测试
|
||||
if test_url_grace "$iso" "$iso_filetype"; then
|
||||
iso_tested=true
|
||||
else
|
||||
msg="Could not find direct link for $iso"
|
||||
if ! iso=$(grep -oE 'https?.*\.iso[^"]*' $tmp/img-test | sed 's/&/\&/g' | grep .); then
|
||||
error_and_exit "$msg"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# 测试是否是 iso
|
||||
if ! $iso_tested; then
|
||||
test_url "$iso" "$iso_filetype"
|
||||
fi
|
||||
|
||||
# 判断 iso 架构是否兼容
|
||||
# https://gitlab.com/libosinfo/osinfo-db/-/tree/main/data/os/microsoft.com?ref_type=heads
|
||||
# uupdump linux 下合成的标签是 ARM64,windows下合成的标签是 A64
|
||||
if file -b "$tmp/img-test" | grep -Eq '_(A64|ARM64)'; then
|
||||
iso_arch=arm64
|
||||
else
|
||||
msg="Could not find direct link for $iso"
|
||||
if ! iso=$(grep -oE 'https?.*\.iso[^"]*' $tmp/img-test | sed 's/&/\&/g' | grep .); then
|
||||
error_and_exit "$msg"
|
||||
iso_arch=x86_or_x64
|
||||
fi
|
||||
|
||||
if ! {
|
||||
{ [ "$basearch" = x86_64 ] && [ "$iso_arch" = x86_or_x64 ]; } ||
|
||||
{ [ "$basearch" = aarch64 ] && [ "$iso_arch" = arm64 ]; }
|
||||
}; then
|
||||
warn "
|
||||
The current machine is $basearch, but it seems the ISO is for $iso_arch. Continue?
|
||||
当前机器是 $basearch,但 ISO 似乎是 $iso_arch。继续安装?"
|
||||
read -r -p '[y/N]: '
|
||||
if ! [[ "$REPLY" = [Yy] ]]; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# 测试是否是 iso
|
||||
if ! $iso_tested; then
|
||||
test_url "$iso" "$iso_filetype"
|
||||
fi
|
||||
|
||||
[ -n "$boot_wim" ] && test_url "$boot_wim" 'wim'
|
||||
|
||||
# 判断 iso 架构是否兼容
|
||||
# https://gitlab.com/libosinfo/osinfo-db/-/tree/main/data/os/microsoft.com?ref_type=heads
|
||||
if file -b "$tmp/img-test" | grep -q '_A64'; then
|
||||
iso_arch=arm64
|
||||
else
|
||||
iso_arch=x86_or_x64
|
||||
fi
|
||||
|
||||
if ! {
|
||||
{ [ "$basearch" = x86_64 ] && [ "$iso_arch" = x86_or_x64 ]; } ||
|
||||
{ [ "$basearch" = aarch64 ] && [ "$iso_arch" = arm64 ]; }
|
||||
}; then
|
||||
warn "
|
||||
The current machine is $basearch, but it seems the ISO is for $iso_arch. Continue?
|
||||
当前机器是 $basearch,但 ISO 似乎是 $iso_arch。继续安装?"
|
||||
read -r -p '[y/N]: '
|
||||
if ! [[ "$REPLY" = [Yy] ]]; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
eval "${step}_iso='$iso'"
|
||||
eval "${step}_boot_wim='$boot_wim'"
|
||||
eval "${step}_image_name='$image_name'"
|
||||
|
||||
Reference in New Issue
Block a user