el: 重新支持 centos 7

This commit is contained in:
bin456789 2024-07-14 22:12:59 +08:00
parent c1713c406e
commit 784e26608f
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 27 additions and 3 deletions

View File

@ -1033,7 +1033,16 @@ setos() {
esac
fi
case $distro in
"centos") ci_image=$ci_mirror/$releasever-stream/$basearch/images/CentOS-Stream-GenericCloud-$releasever-latest.$basearch.qcow2 ;;
"centos")
case $releasever in
"7")
# aarch64 需要特殊处理
[ "$basearch" = aarch64 ] && ver=-2211 || ver=
ci_image=$ci_mirror/$releasever/images/CentOS-$releasever-$basearch-GenericCloud$ver.qcow2
;;
"9") ci_image=$ci_mirror/$releasever-stream/$basearch/images/CentOS-Stream-GenericCloud-$releasever-latest.$basearch.qcow2 ;;
esac
;;
"alma") ci_image=$ci_mirror/AlmaLinux-$releasever-GenericCloud-latest.$basearch.qcow2 ;;
"rocky") ci_image=$ci_mirror/Rocky-$releasever-GenericCloud-Base.latest.$basearch.qcow2 ;;
"fedora")
@ -1204,8 +1213,9 @@ verify_os_name() {
usage_and_exit
fi
# 不要删除 centos 7
for os in \
'centos |9' \
'centos 7|9' \
'anolis 7|8' \
'oracle 8|9' \
'alma 8|9' \

View File

@ -1643,7 +1643,8 @@ create_cloud_init_network_config() {
# anolis 7: cloud-init 19.1
# openeuler 20.03: cloud-init 19.4
# shellcheck disable=SC2154
if { [ "$distro" = anolis ] && [ "$releasever" = 7 ]; } ||
if { [ "$distro" = centos ] && [ "$releasever" = 7 ]; } ||
{ [ "$distro" = anolis ] && [ "$releasever" = 7 ]; } ||
{ [ "$distro" = openeuler ] && [ "$releasever" = 20.03 ]; }; then
type_ipv6_static=static
else
@ -2423,6 +2424,19 @@ install_qcow_by_copy() {
fi
fi
# centos 7 eol 特殊处理
if [ "$releasever" = 7 ] && [ -f /os/etc/yum.repos.d/CentOS-Base.repo ]; then
# 保持默认的 http 因为自带的 ssl 证书可能过期
if is_in_china; then
mirror=mirrors.ustc.edu.cn/centos-vault
else
mirror=vault.centos.org
fi
sed -Ei -e 's,(mirrorlist=),#\1,' \
-e "s,#(baseurl=http://)mirror.centos.org,\1$mirror," /os/etc/yum.repos.d/CentOS-Base.repo
chroot_dnf install NetworkManager
fi
# anolis 7 镜像自带 nm
# 删除云镜像自带的 dhcp 配置,防止歧义