core: 支持原系统为 alpine edge

This commit is contained in:
bin456789 2023-08-25 13:04:06 +08:00
parent 4131fbc461
commit c830907cef
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 18 additions and 6 deletions

View File

@ -156,9 +156,15 @@ test_url() {
}
add_community_repo_for_alpine() {
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
# 先检查原来的repo是不是egde
if grep -x 'http.*/edge/main' /etc/apk/repositories; then
alpine_ver=edge
else
alpine_ver=v$(cut -d. -f1,2 </etc/alpine-release)
fi
if ! grep -x "http.*/$alpine_ver/community" /etc/apk/repositories; then
echo http://dl-cdn.alpinelinux.org/alpine/$alpine_ver/community >>/etc/apk/repositories
fi
}

View File

@ -30,9 +30,15 @@ error_and_exit() {
}
add_community_repo() {
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
# 先检查原来的repo是不是egde
if grep -x 'http.*/edge/main' /etc/apk/repositories; then
alpine_ver=edge
else
alpine_ver=v$(cut -d. -f1,2 </etc/alpine-release)
fi
if ! grep -x "http.*/$alpine_ver/community" /etc/apk/repositories; then
echo http://dl-cdn.alpinelinux.org/alpine/$alpine_ver/community >>/etc/apk/repositories
fi
}