修复: Debian系统阿里云镜像源配置错误

- 分离Ubuntu和Debian的源配置逻辑
- Debian使用正确的组件: main, contrib, non-free, non-free-firmware
- Debian安全源使用debian-security仓库
- Ubuntu继续使用: main, restricted, universe, multiverse
- 修复apt更新时的组件缺失警告
This commit is contained in:
WanWanYun
2025-11-10 23:13:13 +08:00
parent 20d852027f
commit 650b926a0b

View File

@@ -189,18 +189,33 @@ configure_aliyun_mirror() {
print_step "配置阿里云镜像源..."
case $OS in
ubuntu|debian)
ubuntu)
# 备份原有源
if [[ ! -f /etc/apt/sources.list.bak ]]; then
cp /etc/apt/sources.list /etc/apt/sources.list.bak
fi
# 配置阿里云源
# 配置Ubuntu阿里云源
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs) main restricted universe multiverse
deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs)-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs)-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/$OS/ $(lsb_release -cs)-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse
EOF
print_success "阿里云源配置完成"
;;
debian)
# 备份原有源
if [[ ! -f /etc/apt/sources.list.bak ]]; then
cp /etc/apt/sources.list /etc/apt/sources.list.bak
fi
# 配置Debian阿里云源
cat > /etc/apt/sources.list << EOF
deb http://mirrors.aliyun.com/debian/ $(lsb_release -cs) main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian/ $(lsb_release -cs)-updates main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian/ $(lsb_release -cs)-backports main contrib non-free non-free-firmware
deb http://mirrors.aliyun.com/debian-security $(lsb_release -cs)-security main contrib non-free non-free-firmware
EOF
print_success "阿里云源配置完成"
;;
@@ -216,7 +231,6 @@ EOF
;;
esac
}
################################################################################
# 安装依赖环境
################################################################################