diff --git a/README.en.md b/README.en.md index 9943163..31ba7a2 100644 --- a/README.en.md +++ b/README.en.md @@ -228,7 +228,6 @@ bash reinstall.sh windows \ - Massgrave - (Recommended, iso sourced from official channels, updated monthly, includes the latest patches) - Microsoft - - - (Need to open it with a mobile User-Agent) - - (Preview) diff --git a/README.md b/README.md index cb7db5d..7fdd2cf 100644 --- a/README.md +++ b/README.md @@ -228,7 +228,6 @@ bash reinstall.sh windows \ - Massgrave - (推荐,iso 来自官方,每月更新,包含最新补丁) - 微软 - - - (需用手机 User-Agent 打开) - - (预览版) diff --git a/reinstall.sh b/reinstall.sh index 70c8d6c..b663cbc 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -1385,17 +1385,24 @@ install_pkg() { esac } - try_find_epel_name() { - epel=$($pkg_mgr repolist --all | awk '{print $1}' | grep -Ei '(epel|epol)$') + get_epel_repo_name() { + # el7 不支持 yum repolist --all,要使用 yum repolist all + # el7 yum repolist 第一栏有 /x86_64 后缀,因此要去掉。而 el9 没有 + $pkg_mgr repolist all | awk '{print $1}' | awk -F/ '{print $1}' | grep -Ei '(epel|epol)$' + } + + get_epel_pkg_name() { + $pkg_mgr list | grep -E '(epel|epol)-release' | awk '{print $1}' | cut -d. -f1 | head -1 } if is_need_epel; then - if ! try_find_epel_name; then - epel_release="$($pkg_mgr list | grep -E '(epel|epol)-release' | awk '{print $1}' | cut -d. -f1 | head -1)" - $pkg_mgr install -y $epel_release - try_find_epel_name + if ! epel=$(get_epel_repo_name); then + $pkg_mgr install -y "$(get_epel_pkg_name)" + epel=$(get_epel_repo_name) fi enable_epel="--enablerepo=$epel" + else + enable_epel= fi }