mirror of
https://github.com/spiritLHLS/one-click-installation-script.git
synced 2024-11-16 14:52:19 +08:00
Update toubuntu22.sh
This commit is contained in:
parent
fb5b348ae2
commit
205c7189d4
|
@ -1,9 +1,16 @@
|
|||
#!/bin/bash
|
||||
#from https://github.com/spiritLHLS/one-click-installation-script
|
||||
|
||||
# 打印信息
|
||||
_red() { echo -e "\033[31m\033[01m$@\033[0m"; }
|
||||
_green() { echo -e "\033[32m\033[01m$@\033[0m"; }
|
||||
_yellow() { echo -e "\033[33m\033[01m$@\033[0m"; }
|
||||
_blue() { echo -e "\033[36m\033[01m$@\033[0m"; }
|
||||
reading(){ read -rp "$(_green "$1")" "$2"; }
|
||||
|
||||
# 检查是否有sudo权限
|
||||
if [ $(id -u) -ne 0 ]; then
|
||||
echo "This script must be run as root. Please run with sudo." >&2
|
||||
_red "This script must be run as root. Please run with sudo." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -15,7 +22,7 @@ SUPPORTED_VERSIONS=("16.04" "17.04" "17.10" "18.04" "19.04" "19.10" "20.04" "20.
|
|||
|
||||
# 检查是否支持当前版本的升级
|
||||
if [[ ! " ${SUPPORTED_VERSIONS[@]} " =~ " ${CURRENT_VER} " ]]; then
|
||||
echo "Unsupported Ubuntu version. This script supports Ubuntu 16, 17, 18, 19, 20 and 21 only." >&2
|
||||
_red "Unsupported Ubuntu version. This script supports Ubuntu 16, 17, 18, 19, 20 and 21 only." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -25,30 +32,30 @@ apt-get install -y update-manager-core
|
|||
|
||||
# 升级 Ubuntu 16 到 18
|
||||
if [ "$CURRENT_VER" == "16.04" ]; then
|
||||
echo "Upgrading Ubuntu 16 to 18..."
|
||||
_green "Upgrading Ubuntu 16 to 18..."
|
||||
sed -i 's/xenial/bionic/g' /etc/apt/sources.list
|
||||
do-release-upgrade -d -f DistUpgradeViewNonInteractive
|
||||
|
||||
# 升级 Ubuntu 17 到 18
|
||||
elif [ "$CURRENT_VER" == "17.04" ] || [ "$CURRENT_VER" == "17.10" ]; then
|
||||
echo "Upgrading Ubuntu 17 to 18..."
|
||||
_green "Upgrading Ubuntu 17 to 18..."
|
||||
sed -i 's/zesty/bionic/g' /etc/apt/sources.list
|
||||
do-release-upgrade -d -f DistUpgradeViewNonInteractive
|
||||
|
||||
# 升级 Ubuntu 18 到 20
|
||||
elif [ "$CURRENT_VER" == "18.04" ]; then
|
||||
echo "Upgrading Ubuntu 18 to 20..."
|
||||
_green "Upgrading Ubuntu 18 to 20..."
|
||||
do-release-upgrade -d -f DistUpgradeViewNonInteractive
|
||||
|
||||
# 升级 Ubuntu 19 到 20
|
||||
elif [ "$CURRENT_VER" == "19.04" ] || [ "$CURRENT_VER" == "19.10" ]; then
|
||||
echo "Upgrading Ubuntu 19 to 20..."
|
||||
_green "Upgrading Ubuntu 19 to 20..."
|
||||
sed -i 's/disco/eoan/g' /etc/apt/sources.list
|
||||
do-release-upgrade -d -f DistUpgradeViewNonInteractive
|
||||
|
||||
# 升级 Ubuntu 20 或 21 到 22
|
||||
else
|
||||
echo "Upgrading Ubuntu 20/21 to 22..."
|
||||
_green "Upgrading Ubuntu 20/21 to 22..."
|
||||
do-release-upgrade -d -f DistUpgradeViewNonInteractive
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user