Update debian.sh

This commit is contained in:
Xiufeng Guo 2024-06-21 21:31:39 +09:00
parent b51b8b2191
commit b18de8ddae
Signed by: showfom
GPG Key ID: 29A7777777777777

View File

@ -2,8 +2,8 @@
######################################################### #########################################################
# Function :Initial Server Setup for Debian Server # # Function :Initial Server Setup for Debian Server #
# Platform :Debian 11.x Bullseye and 12.x Bookworm # # Platform :Debian 11.x Bullseye and 12.x Bookworm #
# Version :1.4 # # Version :1.5 #
# Date :09-05-2023 # # Date :21-06-2024 #
# Author :Xiufeng Guo # # Author :Xiufeng Guo #
# Contact :i@m.ac # # Contact :i@m.ac #
# Company :xTom # # Company :xTom #
@ -75,26 +75,24 @@ function change_apt_sources() {
if [ "$codename" == "buster" ]; then if [ "$codename" == "buster" ]; then
cat > /etc/apt/sources.list << EOF cat > /etc/apt/sources.list << EOF
deb https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free 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 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 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 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 EOF
# If codename = bullseye, use the new sources.list # If codename = bullseye, use the new sources.list
elif [ "$codename" == "bullseye" ]; then elif [ "$codename" == "bullseye" ]; then
cat > /etc/apt/sources.list << EOF cat > /etc/apt/sources.list << EOF
deb https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free 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 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 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 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 EOF
# If codename = bookworm, use the new sources.list # If codename = bookworm, use the new sources.list
@ -102,13 +100,12 @@ EOF
cat > /etc/apt/sources.list << EOF cat > /etc/apt/sources.list << EOF
deb https://mirror-cdn.xtom.com/debian/ $codename main contrib non-free non-free-firmware 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 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/ $codename-updates 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 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 EOF
# If codename = others, then exit # If codename = others, then exit
else else
@ -411,6 +408,17 @@ function add_tor_repo() {
printf "\E[0m" 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() { function add_unattended_upgrades() {
printf "\E[0;35;40m" printf "\E[0;35;40m"
echo '### Enable Unattended Upgrades ###' echo '### Enable Unattended Upgrades ###'
@ -455,7 +463,8 @@ function add_rclone() {
printf "\E[0;35;40m" printf "\E[0;35;40m"
echo '### Install Rclone ###' echo '### Install Rclone ###'
printf "\E[0m" 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 dpkg -i /tmp/rclone.deb
rm /tmp/rclone.deb rm /tmp/rclone.deb
printf "\E[0;33;40m" 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 15 "Add MariaDB Repo" off
16 "Add PostgreSQL Repo" off 16 "Add PostgreSQL Repo" off
17 "Add Tor Project Repo" off 17 "Add Tor Project Repo" off
18 "Install acme.sh" off 18 "Add Redis Repo" off
19 "Install Rclone" off 19 "Install acme.sh" off
20 "Add update.sh" on) 20 "Install Rclone" off
21 "Add update.sh" on)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
clear clear
for choice in $choices for choice in $choices
@ -561,12 +571,15 @@ do
add_tor_repo add_tor_repo
;; ;;
18) 18)
add_acme_sh add_redis_repo
;; ;;
19) 19)
add_rclone add_acme_sh
;; ;;
20) 20)
add_rclone
;;
21)
add_update_sh add_update_sh
;; ;;
esac esac