el: 重新支持 centos 7

This commit is contained in:
bin456789
2024-07-14 22:12:59 +08:00
parent c1713c406e
commit 784e26608f
2 changed files with 27 additions and 3 deletions

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 配置,防止歧义