Update package.sh

This commit is contained in:
spiritLHLS 2022-12-17 21:27:47 +08:00 committed by GitHub
parent 7d9fa02750
commit d71712777f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,8 +41,6 @@ change_debian_apt_sources() {
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# Determine Debian version
DEBIAN_VERSION=$(lsb_release -sr)
# Get the current system version
DEBIAN_VERSION=$(lsb_release -sr)
if [ "$location" = "China" ]; then
# IP is in China, update apt sources
@ -165,9 +163,16 @@ EOF
change_ubuntu_apt_sources() {
# Check if the IP is in China
ip=$(curl -s https://ipapi.co/ip)
location=$(curl -s https://ipapi.co/$ip/country_name)
# Check the system's Ubuntu version
ubuntu_version=$(lsb_release -r | awk '{print $2}')
if [ "$location" = "China" ]; then
# IP is in China, update apt sources
echo "IP is in China, updating apt sources."
else:
if [ "$ubuntu_version" = "12.04" ]; then
# Backup the current sources.list
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
@ -218,6 +223,7 @@ change_ubuntu_apt_sources() {
else
echo "The system is not Ubuntu 12/14/16/18/20/22 . No changes were made to the apt sources."
fi
fi
}
fix_broken() {