common: 改善逻辑和错误

This commit is contained in:
bin456789
2023-07-05 21:57:27 +08:00
parent 82181c8090
commit 1f1785c105
2 changed files with 33 additions and 15 deletions

View File

@ -26,8 +26,10 @@ error() {
}
add_community_repo() {
alpine_ver=$(cut -d. -f1,2 </etc/alpine-release)
echo http://dl-cdn.alpinelinux.org/alpine/v$alpine_ver/community >>/etc/apk/repositories
if ! grep -x 'http.*/community' /etc/apk/repositories; then
alpine_ver=$(cut -d. -f1,2 </etc/alpine-release)
echo http://dl-cdn.alpinelinux.org/alpine/v$alpine_ver/community >>/etc/apk/repositories
fi
}
cp() {