mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-18 20:39:14 +08:00
el: 优化判断系统是否为 el7 家族
This commit is contained in:
parent
34f64e31db
commit
72383f46b2
36
trans.sh
36
trans.sh
@ -3146,6 +3146,11 @@ del_default_user() {
|
||||
done < <(grep -v nologin$ "$os_dir/etc/passwd" | cut -d: -f1 | grep -v root)
|
||||
}
|
||||
|
||||
is_el7_family() {
|
||||
is_have_cmd_on_disk "$1" yum &&
|
||||
! is_have_cmd_on_disk "$1" dnf
|
||||
}
|
||||
|
||||
install_qcow_by_copy() {
|
||||
info "Install qcow2 by copy"
|
||||
|
||||
@ -3307,18 +3312,13 @@ install_qcow_by_copy() {
|
||||
# selinux kdump
|
||||
disable_selinux_kdump /os
|
||||
|
||||
# centos7 删除 machine-id 后不会自动重建
|
||||
# el7 删除 machine-id 后不会自动重建
|
||||
clear_machine_id /os
|
||||
|
||||
# el7 yum 可能会使用 ipv6,即使没有 ipv6 网络
|
||||
if [ "$releasever" = 7 ]; then
|
||||
if [ "$(cat /dev/netconf/eth*/ipv6_has_internet | sort -u)" = 0 ]; then
|
||||
echo 'ip_resolve=4' >>/os/etc/yum.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# centos 7 eol 特殊处理
|
||||
if [ "$releasever" = 7 ] && [ -f /os/etc/yum.repos.d/CentOS-Base.repo ]; then
|
||||
# el7 forks 特殊处理
|
||||
if is_el7_family /os; then
|
||||
# centos 7 eol 换源
|
||||
if [ -f /os/etc/yum.repos.d/CentOS-Base.repo ]; then
|
||||
# 保持默认的 http 因为自带的 ssl 证书可能过期
|
||||
if is_in_china; then
|
||||
mirror=mirror.nju.edu.cn/centos-vault
|
||||
@ -3329,18 +3329,22 @@ install_qcow_by_copy() {
|
||||
-e "s,#(baseurl=http://)mirror.centos.org,\1$mirror," /os/etc/yum.repos.d/CentOS-Base.repo
|
||||
fi
|
||||
|
||||
# el7 yum 可能会使用 ipv6,即使没有 ipv6 网络
|
||||
if [ "$(cat /dev/netconf/eth*/ipv6_has_internet | sort -u)" = 0 ]; then
|
||||
echo 'ip_resolve=4' >>/os/etc/yum.conf
|
||||
fi
|
||||
|
||||
# el7 安装 NetworkManager
|
||||
# anolis 7 镜像自带 NetworkManager
|
||||
chroot_dnf install NetworkManager
|
||||
fi
|
||||
|
||||
# firmware + microcode
|
||||
if is_need_ucode_firmware; then
|
||||
# shellcheck disable=SC2046
|
||||
chroot_dnf install $(get_ucode_firmware_pkgs)
|
||||
fi
|
||||
|
||||
# centos 7 安装 NetworkManager
|
||||
if [ "$releasever" = 7 ]; then
|
||||
chroot_dnf install NetworkManager
|
||||
fi
|
||||
# anolis 7 镜像自带 nm
|
||||
|
||||
# 删除云镜像自带的 dhcp 配置,防止歧义
|
||||
# clout-init 网络配置在 /etc/sysconfig/network-scripts/
|
||||
rm -rf /os/etc/NetworkManager/system-connections/*.nmconnection
|
||||
|
Loading…
x
Reference in New Issue
Block a user