Skip to content

Commit

Permalink
Merge pull request #302 from s41m0n/fix/ubuntu20_pre_requirements
Browse files Browse the repository at this point in the history
Fix Missing `bc` command
  • Loading branch information
frisso committed May 14, 2020
2 parents b4a128e + 29a201f commit 6437c4d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/pre-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ mkdir -p $WORKDIR
$SUDO apt update
$SUDO bash -c "apt install --allow-unauthenticated -y wget gnupg2 software-properties-common"

os_limit="20.04"
os_version=`cat /etc/os-release | grep -Po 'VERSION_ID="\K.*?(?=")'`
# Release in which has been natively introduced support for golang-go (Ubuntu >= 20.04)
os_limit_major="20"
os_limit_minor="04"
read -r os_major os_minor<<<$(grep -Po 'VERSION_ID="\K.*?(?=")' /etc/os-release | sed 's/\./ /g')

# golang v1.12 still not available in repos for Ubuntu versions < 20.04
if (( $(echo "$os_version < $os_limit" | bc -l) ))
# Checking whether the major release is lower or the minor
if (( os_major < os_limit_major || ( os_major == os_limit_major && os_minor < os_limit_minor ) ))
then
$SUDO add-apt-repository ppa:longsleep/golang-backports -y || true
fi
Expand Down

0 comments on commit 6437c4d

Please sign in to comment.