diff --git a/debian.sh b/debian.sh index 8c87c8d..74e22ff 100644 --- a/debian.sh +++ b/debian.sh @@ -2,8 +2,8 @@ ######################################################### # Function :Initial Server Setup for Debian Server # # Platform :Debian 11.x Bullseye and 12.x Bookworm # -# Version :1.4 # -# Date :09-05-2023 # +# Version :1.5 # +# Date :21-06-2024 # # Author :Xiufeng Guo # # Contact :i@m.ac # # Company :xTom # @@ -75,26 +75,24 @@ function change_apt_sources() { if [ "$codename" == "buster" ]; then cat > /etc/apt/sources.list << EOF deb https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free + deb https://mirror-cdn.xtom.com/debian-security/ $codename/updates main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian-security/ $codename/updates main contrib non-free + deb https://mirror-cdn.xtom.com/debian/ $codename-updates main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian/ $codename-updates main contrib non-free + deb https://mirror-cdn.xtom.com/debian/ $codename-backports main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian/ $codename-backports main contrib non-free EOF # If codename = bullseye, use the new sources.list elif [ "$codename" == "bullseye" ]; then cat > /etc/apt/sources.list << EOF deb https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free + deb https://mirror-cdn.xtom.com/debian-security/ $codename-security main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian-security/ $codename-security main contrib non-free + deb https://mirror-cdn.xtom.com/debian/ $codename-updates main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian/ $codename-updates main contrib non-free + deb https://mirror-cdn.xtom.com/debian/ $codename-backports main contrib non-free -deb-src https://mirror-cdn.xtom.com/debian/ $codename-backports main contrib non-free EOF # If codename = bookworm, use the new sources.list @@ -102,13 +100,12 @@ EOF cat > /etc/apt/sources.list << EOF deb https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free non-free-firmware -deb-src https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free non-free-firmware -deb https://mirror-cdn.xtom.com/debian-security $codename-security main contrib non-free non-free-firmware -deb-src https://mirror-cdn.xtom.com/debian-security $codename-security main contrib non-free non-free-firmware + +deb https://mirror-cdn.xtom.com/debian-security/ $codename-security main contrib non-free non-free-firmware + deb https://mirror-cdn.xtom.com/debian/ $codename-updates main contrib non-free non-free-firmware -deb-src https://mirror-cdn.xtom.com/debian/ $codename-updates main contrib non-free non-free-firmware + deb https://mirror-cdn.xtom.com/debian/ $codename-backports main contrib non-free non-free-firmware -deb-src https://mirror-cdn.xtom.com/debian/ $codename-backports main contrib non-free non-free-firmware EOF # If codename = others, then exit else @@ -411,6 +408,17 @@ function add_tor_repo() { printf "\E[0m" } +function add_redis_repo() { + printf "\E[0;35;40m" + echo '### Add Redis repo ###' + printf "\E[0m" + curl -sSL https://packages.redis.io/gpg | gpg --dearmor > /usr/share/keyrings/redis.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/redis.gpg] https://packages.redis.io/deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/redis.list + printf "\E[0;33;40m" + echo "### Redis repo added ###" + printf "\E[0m" +} + function add_unattended_upgrades() { printf "\E[0;35;40m" echo '### Enable Unattended Upgrades ###' @@ -455,7 +463,8 @@ function add_rclone() { printf "\E[0;35;40m" echo '### Install Rclone ###' printf "\E[0m" - wget -O /tmp/rclone.deb https://downloads.rclone.org/rclone-current-linux-$(dpkg --print-architecture).deb + VERSION=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest rclone version is $VERSION" + wget -O /tmp/rclone.deb https://github.com/rclone/rclone/releases/download/$VERSION/rclone-$VERSION-linux-$(dpkg --print-architecture).deb dpkg -i /tmp/rclone.deb rm /tmp/rclone.deb printf "\E[0;33;40m" @@ -501,9 +510,10 @@ options=(1 "Install Packages" on # any option can be set to default to "on" 15 "Add MariaDB Repo" off 16 "Add PostgreSQL Repo" off 17 "Add Tor Project Repo" off - 18 "Install acme.sh" off - 19 "Install Rclone" off - 20 "Add update.sh" on) + 18 "Add Redis Repo" off + 19 "Install acme.sh" off + 20 "Install Rclone" off + 21 "Add update.sh" on) choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) clear for choice in $choices @@ -561,12 +571,15 @@ do add_tor_repo ;; 18) - add_acme_sh + add_redis_repo ;; 19) - add_rclone + add_acme_sh ;; 20) + add_rclone + ;; + 21) add_update_sh ;; esac