Make ubuntu_setup.sh use codenames to support Ubuntu based distros (#25261)

Using codenames allows the ubuntu_setup.sh to install
properly on systems like Pop!_OS or Linux Mint.
old-commit-hash: 551d2fe511
taco
pcjx 3 years ago committed by GitHub
parent 6b0e3c8a26
commit 3ccab8345c
  1. 16
      tools/ubuntu_setup.sh

@ -69,7 +69,7 @@ function install_ubuntu_common_requirements() {
} }
# Install Ubuntu 22.04 LTS packages # Install Ubuntu 22.04 LTS packages
function install_ubuntu_latest_requirements() { function install_ubuntu_jammy_requirements() {
install_ubuntu_common_requirements install_ubuntu_common_requirements
sudo apt-get install -y --no-install-recommends \ sudo apt-get install -y --no-install-recommends \
@ -81,7 +81,7 @@ function install_ubuntu_latest_requirements() {
} }
# Install Ubuntu 20.04 packages # Install Ubuntu 20.04 packages
function install_ubuntu_lts_requirements() { function install_ubuntu_focal_requirements() {
install_ubuntu_common_requirements install_ubuntu_common_requirements
sudo apt-get install -y --no-install-recommends \ sudo apt-get install -y --no-install-recommends \
@ -93,12 +93,12 @@ function install_ubuntu_lts_requirements() {
# Detect OS using /etc/os-release file # Detect OS using /etc/os-release file
if [ -f "/etc/os-release" ]; then if [ -f "/etc/os-release" ]; then
source /etc/os-release source /etc/os-release
case "$ID $VERSION_ID" in case "$VERSION_CODENAME" in
"ubuntu 22.04") "jammy")
install_ubuntu_latest_requirements install_ubuntu_jammy_requirements
;; ;;
"ubuntu 20.04") "focal")
install_ubuntu_lts_requirements install_ubuntu_focal_requirements
;; ;;
*) *)
echo "$ID $VERSION_ID is unsupported. This setup script is written for Ubuntu 20.04." echo "$ID $VERSION_ID is unsupported. This setup script is written for Ubuntu 20.04."
@ -107,7 +107,7 @@ if [ -f "/etc/os-release" ]; then
if [[ ! $REPLY =~ ^[Yy]$ ]]; then if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1 exit 1
fi fi
install_ubuntu_lts_requirements install_ubuntu_focal_requirements
esac esac
else else
echo "No /etc/os-release in the system" echo "No /etc/os-release in the system"

Loading…
Cancel
Save