#!/bin/bash # 备份原始 sources.list 文件 cp /etc/apt/sources.list /etc/apt/sources.list.bak # 覆盖写入新的 sources.list 内容 cat > /etc/apt/sources.list << EOF deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.aliyun.com/debian-security/ bookworm-security main deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib EOF # 输出提示信息 echo "sources.list 已更新,备份文件为 /etc/apt/sources.list.bak"