Skip to content

Commit

Permalink
simplify install.sh ubuntu version tracking (#11288)
Browse files Browse the repository at this point in the history
* simplify install.sh ubuntu version tracking

* quotes for bash

* undo some unintended changes
  • Loading branch information
altendky authored Apr 25, 2022
1 parent 3f0dd49 commit bcaa5e6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,24 @@ fi
# Get submodules
git submodule update --init mozilla-ca

UBUNTU_PRE_2004=false
UBUNTU_PRE_2004=0
UBUNTU_2000=0
UBUNTU_2100=0

if $UBUNTU; then
LSB_RELEASE=$(lsb_release -rs)
# In case Ubuntu minimal does not come with bc
if ! command -v bc > /dev/null 2>&1; then
sudo apt install bc -y
fi
# Mint 20.04 responds with 20 here so 20 instead of 20.04
UBUNTU_PRE_2004=$(echo "$LSB_RELEASE<20" | bc)
UBUNTU_2100=$(echo "$LSB_RELEASE>=21" | bc)
if [ "$(echo "$LSB_RELEASE<20" | bc)" = "1" ]; then
UBUNTU_PRE_2004=1
elif [ "$(echo "$LSB_RELEASE<21" | bc)" = "1" ]; then
UBUNTU_2000=1
else
UBUNTU_2100=1
fi
fi

install_python3_and_sqlite3_from_source_with_yum() {
Expand Down Expand Up @@ -114,16 +122,16 @@ install_python3_and_sqlite3_from_source_with_yum() {
# Manage npm and other install requirements on an OS specific basis
if [ "$(uname)" = "Linux" ]; then
#LINUX=1
if [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "1" ]; then
if [ "$UBUNTU_PRE_2004" = "1" ]; then
# Ubuntu
echo "Installing on Ubuntu pre 20.04 LTS."
sudo apt-get update
sudo apt-get install -y python3.7-venv python3.7-distutils openssl
elif [ "$UBUNTU" = "true" ] && [ "$UBUNTU_PRE_2004" = "0" ] && [ "$UBUNTU_2100" = "0" ]; then
elif [ "$UBUNTU_2000" = "1" ]; then
echo "Installing on Ubuntu 20.04 LTS."
sudo apt-get update
sudo apt-get install -y python3.8-venv python3-distutils openssl
elif [ "$UBUNTU" = "true" ] && [ "$UBUNTU_2100" = "1" ]; then
elif [ "$UBUNTU_2100" = "1" ]; then
echo "Installing on Ubuntu 21.04 or newer."
sudo apt-get update
sudo apt-get install -y python3.9-venv python3-distutils openssl
Expand Down

0 comments on commit bcaa5e6

Please sign in to comment.