ubuntu: 修复更改国内源时没改动 24.04 新增的 ubuntu.sources

This commit is contained in:
bin456789 2024-05-22 21:44:21 +08:00
parent b5122830c9
commit 836ba3f1f1
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -2332,7 +2332,16 @@ EOF
# 更改源
if is_in_china; then
sed -i 's/archive.ubuntu.com/cn.archive.ubuntu.com/' $os_dir/etc/apt/sources.list
# 22.04 使用 /etc/apt/sources.list
# 24.04 使用 /etc/apt/sources.list.d/ubuntu.sources
for file in $os_dir/etc/apt/sources.list $os_dir/etc/apt/sources.list.d/ubuntu.sources; do
if [ -f $file ]; then
# cn.archive.ubuntu.com 不在国内还严重丢包
# https://www.itdog.cn/ping/cn.archive.ubuntu.com
sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/' $file # x64
sed -i 's/ports.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/' $file # arm
fi
done
fi
# 安装最佳内核