version-manager
version-manager copied to clipboard
Linux downloads fail for `4.1.x`
trafficstars
SERVER-37316 removed generic Linux tarballs so... Travis currently fails hard for MONGODB_VERSION=unstable...
3 things to do:
- [ ] Add detection for specific flavors and versions to
mongodb-download-url(see below) - [ ] Show nice error message and bail if the DL fails
- [ ] Switch to a learna repo and import all
mongodb-version-managerdeps
@stennie pointed me at how to handle this for specific flavors and versions:
local distro_id= distro_version=
if lsb_release >/dev/null 2>&1; then
# If the lsb_release(1) tool is installed, use it.
distro_id=`lsb_release -si`
distro_version=`lsb_release -sr`
if test "$distro_version" = testing; then
distro_version=
fi
fi
if test -z "$distro_version"; then
if test -f /etc/lsb-release; then
# In the case where the distro provides an /etc/lsb-release file, but the lsb_release(1) util isn't installed.
distro_id=$(sed -ne 's/^DISTRIB_ID=//p' /etc/lsb-release | sed -e 's/^["'"'"']//' -e 's/["'"'"']$//' -e 's/\\\(.\)/\1/g')
distro_version=$(sed -ne 's/^DISTRIB_RELEASE=//p' /etc/lsb-release | sed -e 's/^["'"'"']//' -e 's/["'"'"']$//' -e 's/\\\(.\)/\1/g')
elif test -f /etc/debian_version; then
# Debian generally doesn't install lsb_release(1) or a /etc/lsb-release file, so we figure it out manually.
distro_version=`cat /etc/debian_version`
case "$distro_version" in
etch|etch/*)
distro_version=4 ;;
lenny|lenny/*)
distro_version=5 ;;
squeeze|squeeze/*)
distro_version=6 ;;
wheezy|wheezy/*)
distro_version=7 ;;
jessie|jessie/*)
distro_version=8 ;;
stretch|stretch/*)
distro_version=9 ;;
buster|buster/*)
distro_version=10 ;;
bullseye|bullseye/*)
distro_version=11 ;;
bookworm|bookworm/*)
distro_version=12 ;;
esac
distro_id=debian
elif test -f /etc/os-release; then
# Suse, opensuse, amazon linux, centos (but not redhat)
distro_id=$(sed -ne 's/^ID=//p' /etc/os-release | sed -e 's/^["'"'"']//' -e 's/["'"'"']$//' -e 's/\\\(.\)/\1/g')
distro_version=$(sed -ne 's/^VERSION_ID=//p' /etc/os-release | sed -e 's/^["'"'"']//' -e 's/["'"'"']$//' -e 's/\\\(.\)/\1/g')
fi
fi
distro_id=`echo "$distro_id" | tr '[:upper:]' '[:lower:]'`
distro_version=`echo "$distro_version" | tr '[:upper:]' '[:lower:]'`
case "$distro_id" in
sles) distro_id="suse" ;;
opensuse) distro_id="suse" ;;
centos) distro_id="rhel" ;;
redhatenterpriseserver) distro_id="rhel" ;;
esac
local distro="$distro_id-$distro_version"
if test "$community" = 1; then
amazon1="amazon"
else
amazon1="amzn64"
fi
# Different versions of MongoDB have builds for different distributions.
# As m allows installing old MongoDB versions, we can look for
# binaries for distributions that the latest MongoDB release is not
# built for. Conversely, an old MongoDB version does not have to have
# builds available for distributions that the latest version supports.
#
# The logic generally is to start with the correct distribution, then try
# one version older and one version newer. This should handle most cases
# reasonably well.
case "$distro" in
debian-6*) distros="" ;;
debian-7*) distros="debian71" ;;
debian-8*) distros="debian81 debian71" ;;
debian-9*) distros="debian92 debian81 debian71" ;;
debian-*) distros="debian92 debian81 debian71" ;;
ubuntu-12*) distros="ubuntu1204 debian71" ;;
ubuntu-14*) distros="ubuntu1404 ubuntu1204 debian71" ;;
ubuntu-16*) distros="ubuntu1604 ubuntu1404 ubuntu1204 debian71" ;;
ubuntu-18*) distros="ubuntu1804 ubuntu1604 ubuntu1404 ubuntu1204 debian71" ;;
ubuntu-*) distros="ubuntu1804 ubuntu1604 ubuntu1404 ubuntu1204" ;;
suse-10*) distros="" ;;
suse-11*) distros="suse11" ;;
suse-12*) distros="suse12 suse11" ;;
suse-*) distros="suse12 suse11" ;;
amzn-1) distros="$amazon1 rhel70 rhel62" ;;
amzn-2) distros="amazon2 $amazon1 rhel70 rhel62" ;;
amzn-*) distros="amazon2 $amazon1" ;;
rhel-5*) distros="rhel55 rhel57" ;;
rhel-6*) distros="rhel62 rhel55 rhel57 $amazon1" ;;
rhel-7*) distros="rhel70 rhel62 rhel55 rhel57 $amazon1" ;;
rhel-*) distros="rhel70 rhel62 rhel55 rhel57" ;;
*) distros="" ;;
esac
if [ "$_legacy_only" = y ]; then
distros=""
fi
# determine the download url
if [[ "$community" == 1 ]]; then
local tarball="mongodb-$sslbuild-$arch-$version.tgz"
# shadowing earlier $distro
for distro in $distros; do
if good "http://fastdl.mongodb.org/$os/mongodb-$sslbuild-$arch-$distro-$version.tgz"; then
tarball="mongodb-$sslbuild-$arch-$distro-$version.tgz"
break
fi
done
local url="http://fastdl.mongodb.org/$os/$tarball"
else # enterprise version
if [[ "$os" == linux ]]; then
# for linux fetch the rhel7 tarball by default
local dist=rhel70
# shadowing earlier $distro
for distro in $distros; do
if good "http://downloads.10gen.com/$os/mongodb-$os-$arch-enterprise-$distro-$version.tgz"; then
dist=$distro
break
fi
done
local tarball="mongodb-$os-$arch-enterprise-$dist-$version.tgz"
else
local tarball="mongodb-$os-$arch-enterprise-$version.tgz"
fi
local url="http://downloads.10gen.com/$os/$tarball"
version="$version-ent"
fi
@stennie as you already have this in m... any chance you'd be interested in taking this one?
@imlucas I won't have spare tuits for a few weeks, but could pick this up if it hasn't been addressed by then.
mongodb-js/download-url#80