diff --git a/configure_priv.sh b/configure_priv.sh index 03ed126..9431ee3 100755 --- a/configure_priv.sh +++ b/configure_priv.sh @@ -24,6 +24,12 @@ configure_tuna() { if [[ $EUID -ne 0 ]]; then sudo python3 $scriptdir/files/oh-my-tuna.py fi + # 如果 /etc/apt/sources.list.d/ubuntu.sources 存在且文件内有 tuna,则跳过,否则直接覆盖 + if [ -f /etc/apt/sources.list.d/ubuntu.sources ] && grep -q tuna /etc/apt/sources.list.d/ubuntu.sources; then + echo "检测到已切换到 Tuna 源,跳过覆盖。" + else + sudo cp $scriptdir/files/sources.list/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources + fi fi } diff --git a/files/sources.list/ubuntu.sources b/files/sources.list/ubuntu.sources new file mode 100644 index 0000000..66990fc --- /dev/null +++ b/files/sources.list/ubuntu.sources @@ -0,0 +1,11 @@ +Types: deb +URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ +Suites: noble noble-updates noble-backports +Components: main restricted universe multiverse +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg + +Types: deb +URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ +Suites: noble-security +Components: main restricted universe multiverse +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg