diff --git a/init.sh b/init.sh index 761a5b9..3a57fa4 100755 --- a/init.sh +++ b/init.sh @@ -18,26 +18,31 @@ choose_sites(){ MIRROR_URL=https://mirrors.ustc.edu.cn/debian/ SEC_URL=https://mirrors.ustc.edu.cn/debian-security DOCKER_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian + PVE_URL=https://mirrors.ustc.edu.cn/proxmox/debian/pve ;; 2) MIRROR_URL=https://mirrors.xjtu.edu.cn/debian/ SEC_URL=https://mirrors.xjtu.edu.cn/debian-security DOCKER_URL=https://mirrors.xjtu.edu.cn/docker-ce/linux/debian + PVE_URL=https://mirrors.ustc.edu.cn/proxmox/debian/pve ;; 3) MIRROR_URL=https://mirrors.nju.edu.cn/debian/ SEC_URL=https://mirrors.nju.edu.cn/debian-security DOCKER_URL=https://mirrors.nju.edu.cn/docker-ce/linux/debian + PVE_URL=https://mirrors.nju.edu.cn/proxmox/debian/pve ;; 4) MIRROR_URL=https://mirrors.tuna.tsinghua.edu.cn/debian/ SEC_URL=https://mirrors.tuna.tsinghua.edu.cn/debian-security DOCKER_URL=https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian + PVE_URL=https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve ;; *) MIRROR_URL=https://deb.debian.org/debian/ SEC_URL=https://security.debian.org/debian-security DOCKER_URL=https://download.docker.com/linux/debian + PVE_URL=http://download.proxmox.com/debian/pve ;; esac } @@ -62,6 +67,11 @@ deb $MIRROR_URL $OS_CODE-backports main contrib non-free non-free-firmware deb $SEC_URL $OS_CODE-security main contrib non-free non-free-firmware " | tee /etc/apt/sources.list + if [ $FOR_PVE -eq 1 ]; then + echo "deb $PVE_URL bookworm pve-no-subscription" | \ + tee /etc/apt/sources.list.d/pve-no-subscription.list + fi + command="nala" apt update apt install $command || command="apt" @@ -77,26 +87,31 @@ deb $SEC_URL $OS_CODE-security main contrib non-free non-free-firmware gpg --dearmor | tee /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-completions.gpg > /dev/null - echo "deb [arch=$OS_ARCH] $DOCKER_URL $OS_CODE stable" | \ - tee /etc/apt/sources.list.d/docker.list - curl -fsSL "https://download.docker.com/linux/debian/gpg" | \ - gpg --dearmor | tee /etc/apt/trusted.gpg.d/docker.gpg > /dev/null - - echo "deb https://packagecloud.io/ookla/speedtest-cli/debian/ $OS_CODE main" | \ tee /etc/apt/sources.list.d/ookla_speedtest-cli.list curl -fsSL "https://packagecloud.io/ookla/speedtest-cli/gpgkey" | \ gpg --dearmor | tee /etc/apt/trusted.gpg.d/ookla_speedtest-cli-archive-keyring.gpg > /dev/null - echo "deb [arch=$OS_ARCH] http://packages.azlux.fr/debian $OS_CODE main" | \ - tee /etc/apt/sources.list.d/azlux.list - curl -fsSL "https://azlux.fr/repo.gpg.key" | \ - gpg --dearmor | tee /etc/apt/trusted.gpg.d/azlux-archive-keyring.gpg > /dev/null + + if [ $FOR_PVE -eq 0 ]; then + echo "deb [arch=$OS_ARCH] $DOCKER_URL $OS_CODE stable" | \ + tee /etc/apt/sources.list.d/docker.list + curl -fsSL "https://download.docker.com/linux/debian/gpg" | \ + gpg --dearmor | tee /etc/apt/trusted.gpg.d/docker.gpg > /dev/null + + echo "deb [arch=$OS_ARCH] http://packages.azlux.fr/debian $OS_CODE main" | \ + tee /etc/apt/sources.list.d/azlux.list + curl -fsSL "https://azlux.fr/repo.gpg.key" | \ + gpg --dearmor | tee /etc/apt/trusted.gpg.d/azlux-archive-keyring.gpg > /dev/null + fi usermod -s /usr/bin/zsh $(whoami) cp "$SCRIPTPATH/.zshrc" $HOME cp "$SCRIPTPATH/.screenrc" $HOME cp $SCRIPTPATH/*.py $HOME + if [ $FOR_PVE -eq 1 ]; then + cp "$SCRIPTPATH/iommu.sh" $HOME + fi } install_pkg(){ @@ -112,6 +127,7 @@ usage(){ echo "OPTIONS:"; echo " -f package list file (default: $PKG_BASE)"; echo " -i install only"; + echo " -p pve"; echo " -m apt mirror source"; echo " 1 ustc (default)" echo " 2 xjtu" @@ -122,8 +138,9 @@ usage(){ PKG_BASE="$SCRIPTPATH/packages-base" INSTALL_ONLY=0; +FOR_PVE=0; MIRROR_SOURCE=1; -while getopts ":f:im:" OPT; do +while getopts ":f:ipm:" OPT; do case $OPT in f) PKG_BASE=$OPTARG; @@ -131,6 +148,9 @@ while getopts ":f:im:" OPT; do i) INSTALL_ONLY=1; ;; + p) + FOR_PVE=1; + ;; m) MIRROR_SOURCE=$OPTARG; ;; diff --git a/iommu.sh b/iommu.sh new file mode 100755 index 0000000..3c2b72d --- /dev/null +++ b/iommu.sh @@ -0,0 +1,7 @@ +#!/bin/bash +shopt -s nullglob +for d in /sys/kernel/iommu_groups/*/devices/*; do + n=${d#*/iommu_groups/*}; n=${n%%/*} + printf 'IOMMU Group %s ' "$n" + lspci -nns "${d##*/}" +done; diff --git a/packages-base b/packages-base index 3501eb2..cbc9a88 100644 --- a/packages-base +++ b/packages-base @@ -17,10 +17,4 @@ iperf3 mosh screen zsh-completions -docker-ce -docker-ce-cli -containerd.io -docker-buildx-plugin -docker-compose-plugin speedtest -docker-ctop diff --git a/packages-docker b/packages-docker new file mode 100644 index 0000000..63af305 --- /dev/null +++ b/packages-docker @@ -0,0 +1,6 @@ +docker-ce +docker-ce-cli +containerd.io +docker-buildx-plugin +docker-compose-plugin +docker-ctop \ No newline at end of file