From 6024a8434a93de9c9d6ff096fc84eec028340ff9 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sun, 21 Jul 2024 23:57:59 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=BF=AE=E5=A4=8D=20el7=20=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=AE=89=E8=A3=85=20epel=20=E9=87=8C=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E8=BD=AF=E4=BB=B6=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 1 - README.md | 1 - reinstall.sh | 19 +++++++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) 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 }