mirror of
https://github.com/bin456789/reinstall.git
synced 2025-06-19 10:50:06 +00:00
core: 统一测试镜像链接
This commit is contained in:
parent
00562068d0
commit
4024bb346f
23
reinstall.sh
23
reinstall.sh
@ -118,8 +118,7 @@ test_url() {
|
|||||||
echo $url
|
echo $url
|
||||||
|
|
||||||
tmp_file=/tmp/reinstall-img-test
|
tmp_file=/tmp/reinstall-img-test
|
||||||
|
http_code=$(command curl --connect-timeout 5 --retry 3 -Ls -r 0-1048575 -w "%{http_code}" -o $tmp_file $url)
|
||||||
http_code=$(command curl --connect-timeout 5 -Ls -r 0-1048575 -w "%{http_code}" -o $tmp_file $url)
|
|
||||||
if [ "$http_code" != 200 ] && [ "$http_code" != 206 ]; then
|
if [ "$http_code" != 200 ] && [ "$http_code" != 206 ]; then
|
||||||
error "$url not accessible"
|
error "$url not accessible"
|
||||||
return 1
|
return 1
|
||||||
@ -274,7 +273,6 @@ setos() {
|
|||||||
# iso
|
# iso
|
||||||
filename=$(curl -L $mirror | grep -oP "ubuntu-$releasever.*?-live-server-$basearch_alt.iso" | head -1)
|
filename=$(curl -L $mirror | grep -oP "ubuntu-$releasever.*?-live-server-$basearch_alt.iso" | head -1)
|
||||||
iso=$mirror/$filename
|
iso=$mirror/$filename
|
||||||
test_url $iso || exit 1
|
|
||||||
eval ${step}_iso=$iso
|
eval ${step}_iso=$iso
|
||||||
|
|
||||||
# ks
|
# ks
|
||||||
@ -306,7 +304,6 @@ setos() {
|
|||||||
if [ "$(echo "$image_name" | wc -w)" -lt 3 ]; then
|
if [ "$(echo "$image_name" | wc -w)" -lt 3 ]; then
|
||||||
error_and_exit "--image-name wrong."
|
error_and_exit "--image-name wrong."
|
||||||
fi
|
fi
|
||||||
test_url $iso || exit 1
|
|
||||||
eval "${step}_iso='$iso'"
|
eval "${step}_iso='$iso'"
|
||||||
eval "${step}_image_name='$image_name'"
|
eval "${step}_image_name='$image_name'"
|
||||||
}
|
}
|
||||||
@ -316,7 +313,6 @@ setos() {
|
|||||||
if [ -z "$img" ]; then
|
if [ -z "$img" ]; then
|
||||||
error_and_exit "dd need --img"
|
error_and_exit "dd need --img"
|
||||||
fi
|
fi
|
||||||
test_url $img 'xz|gzip' img_type || exit 1
|
|
||||||
eval "${step}_img='$img'"
|
eval "${step}_img='$img'"
|
||||||
eval "${step}_img_type='$img_type'"
|
eval "${step}_img_type='$img_type'"
|
||||||
}
|
}
|
||||||
@ -753,13 +749,20 @@ else
|
|||||||
setos nextos $distro $releasever
|
setos nextos $distro $releasever
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 测试链接
|
||||||
|
# 在 ubuntu 20.04 上,file 命令检测 ubuntu 22.04 iso 结果不正确,所以去掉 iso 检测
|
||||||
|
if is_use_cloud_image; then
|
||||||
|
test_url $finalos_img 'xz|gzip|qemu' finalos_img_type
|
||||||
|
elif is_use_dd; then
|
||||||
|
test_url $finalos_img 'xz|gzip' finalos_img_type
|
||||||
|
elif [ -n "$finalos_img" ]; then
|
||||||
|
test_url $finalos_img
|
||||||
|
elif [ -n "$finalos_iso" ]; then
|
||||||
|
test_url $finalos_iso
|
||||||
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
{
|
{
|
||||||
# 测试 cloud img 链接
|
|
||||||
if is_use_cloud_image; then
|
|
||||||
test_url $finalos_img
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 下载 nextos 内核
|
# 下载 nextos 内核
|
||||||
info download vmlnuz and initrd
|
info download vmlnuz and initrd
|
||||||
echo $nextos_vmlinuz
|
echo $nextos_vmlinuz
|
||||||
|
Loading…
x
Reference in New Issue
Block a user