From ae46a1386f83797d7191d983ba2cc6ffc6f02740 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Fri, 27 Oct 2023 11:50:06 +0800 Subject: [PATCH] =?UTF-8?q?core:=20alpine=20=E6=B7=BB=E5=8A=A0=20community?= =?UTF-8?q?=20repo=20=E6=97=B6=EF=BC=8C=E7=94=A8=E5=8E=9F=E6=9C=89?= =?UTF-8?q?=E7=9A=84=E6=BA=90=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.sh | 8 ++++---- trans.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/reinstall.sh b/reinstall.sh index 63cc6d3..b581a8c 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -205,15 +205,15 @@ test_url_real() { add_community_repo_for_alpine() { # 先检查原来的repo是不是egde - if grep -x 'http.*/edge/main' /etc/apk/repositories; then + if grep -q '^http.*/edge/main$' /etc/apk/repositories; then alpine_ver=edge else alpine_ver=v$(cut -d. -f1,2 >/etc/apk/repositories + if ! grep -q "^http.*/$alpine_ver/community$" /etc/apk/repositories; then + mirror=$(grep '^http.*/main$' /etc/apk/repositories | sed 's,/[^/]*/main$,,' | head -1) + echo $mirror/$alpine_ver/community >>/etc/apk/repositories fi } diff --git a/trans.sh b/trans.sh index 9809495..e358651 100644 --- a/trans.sh +++ b/trans.sh @@ -41,15 +41,15 @@ error_and_exit() { add_community_repo() { # 先检查原来的repo是不是egde - if grep -x 'http.*/edge/main' /etc/apk/repositories; then + if grep -q '^http.*/edge/main$' /etc/apk/repositories; then alpine_ver=edge else alpine_ver=v$(cut -d. -f1,2 >/etc/apk/repositories + if ! grep -q "^http.*/$alpine_ver/community$" /etc/apk/repositories; then + mirror=$(grep '^http.*/main$' /etc/apk/repositories | sed 's,/[^/]*/main$,,' | head -1) + echo $mirror/$alpine_ver/community >>/etc/apk/repositories fi }