From 74f5c8e5e3f2ac0da4039c6e17b1121b2b915e18 Mon Sep 17 00:00:00 2001 From: Konano Date: Sun, 26 Apr 2026 17:03:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20Tuna=20=E6=BA=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20(.sources)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot --- configure_priv.sh | 6 ++++++ files/sources.list/ubuntu.sources | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 files/sources.list/ubuntu.sources 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