#!/bin/bash

# ANSI颜色码
GREEN='\033[0;32m' # 绿色
NC='\033[0m' # 无颜色

# 输入提示
echo -e "${GREEN}请选择要使用的APT源:${NC}"
echo -e "${GREEN}1. 国内${NC}"
echo -e "${GREEN}2. 海外${NC}"

# 获取用户输入
read -p "请输入选项 (1 或 2): " option

# 根据用户输入选择不同的APT源并写入文件
case $option in
    1)
        echo -e "${GREEN}使用国内APT源...${NC}"
        cat << EOF > /etc/apt/sources.list
deb http://mirrors.tencent.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.tencent.com/debian/ bullseye main non-free contrib
deb http://mirrors.tencent.com/debian-security/ bullseye-security main
deb-src http://mirrors.tencent.com/debian-security/ bullseye-security main
deb http://mirrors.tencent.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.tencent.com/debian/ bullseye-updates main non-free contrib
EOF
        ;;
    2)
        echo -e "${GREEN}使用海外APT源...${NC}"
        cat << EOF > /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main
EOF
        ;;
    *)
        echo -e "${GREEN}无效的选项，请输入 1 或 2.${NC}"
        ;;
esac
