Skip to content

Commit

Permalink
[r1.32] Enhance ydbinstall.sh to handle new binary tarball naming con…
Browse files Browse the repository at this point in the history
…vention

* The tarball naming convention changed in r1.32. Previously, we used to default to a platform
  of `linux` and use a tarball that has that name in it. Now there is no `linux` tarball. All
  tarballs have the linux distribution name in them (e.g. `ubuntu`, `debian` etc.) and we only
  pick a tarball which has the target system's linux distribution.

  If we don't find a tarball with a matching distribution, we issue an error (pre-existing logic).

* For comparison, below are the names of the binary tarballs for various supported platforms
  between YottaDB r1.30 and r1.32.

  ```
  r1.30
  ------
  yottadb_r130_linux_aarch64_pro.tgz
  yottadb_r130_linux_armv6l_pro.tgz
  yottadb_r130_linux_armv7l_pro.tgz
  yottadb_r130_centos8_x8664_pro.tgz
  yottadb_r130_debian10_x8664_pro.tgz
  yottadb_r130_linux_x8664_pro.tgz
  yottadb_r130_rhel7_x8664_pro.tgz
  yottadb_r130_ubuntu2004_x8664_pro.tgz

  r1.32
  -----
  yottadb_r132_aarch64_debian11_pro.tgz
  yottadb_r132_aarch64_ubuntu2004_pro.tgz
  yottadb_r132_armv6l_debian11_pro.tgz
  yottadb_r132_x8664_debian11.tgz
  yottadb_r132_x8664_rhel7_pro.tgz
  yottadb_r132_x8664_rhel8_pro.tgz
  yottadb_r132_x8664_ubuntu2004_pro.tgz
  ```

* Additionally, ydbinstall.sh treats `ARMV7L` as equivalent to `ARMV6L` in terms of picking a tarball.
  And treats `CentOS` as equivalent to `RHEL`.

* Also, the logic that recognizes the older binary tarball names in case of pre-r1.32 YottaDB release
  installs is left untouched by moving it into a separate `else` block.
  • Loading branch information
nars1 committed Jul 8, 2021
1 parent 665d4ff commit a8139fd
Showing 1 changed file with 93 additions and 41 deletions.
134 changes: 93 additions & 41 deletions sr_unix/ydbinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -588,53 +588,105 @@ else
# There might be multiple binary tarballs of YottaDB (for various architectures & platforms).
# If so, choose the one that corresponds to the current host.
yottadb_download_urls=`sed 's,/uploads/,\n&,g' ${gtm_tmpdir}/${ydb_version} | grep "^/uploads/" | cut -d')' -f1`
# Determine current host's architecture
# The variables "arch" and "platform" determine which tarball gets chosen so set them appropriately below.
# Determine current host's architecture and store it in "arch" variable.
# Determine current host's OS and store it in "platform" variable.
# Modify "arch" and "platform" based on certain conditions below.
arch=`uname -m | tr -d '_'`
# Determine current host's OS. We expect the OS name in the tarball.
platform=`uname -s | tr '[:upper:]' '[:lower:]'`
if [ $arch = "x8664" ] ; then
# If the current architecture is x86_64 and the distribution is RHEL (including CentOS and SLES)
# or Debian then set the platform to rhel or debian (not linux) as there are specific tarballs
# for these distributions. If the distribution is Ubuntu, then set the platform to ubuntu (not linux)
# if the version is 20.04 or later as there is a specific tarball for newer versions of Ubuntu.
#
# To get the correct binary for CentOS, RHEL and SLES, we treat OS major version 7 as rhel and later versions as centos
case "${osid}" in
rhel|centos|sles)
# CentOS-specific releases of YottaDB for x86_64 happened only after r1.26
if expr r1.26 \< "${ydb_version}" >/dev/null; then
# If the OS major version is later than 7, treat it as centos. Otherwise, treat it as rhel.
if expr r1.30 \< "${ydb_version}" >/dev/null; then
# From r1.32 onwards, the tarball naming conventions changed.
# Below are the tarball names for the r1.32 tarballs.
# yottadb_r132_aarch64_debian11_pro.tgz
# yottadb_r132_aarch64_ubuntu2004_pro.tgz
# yottadb_r132_armv6l_debian11_pro.tgz
# yottadb_r132_x8664_debian11.tgz
# yottadb_r132_x8664_rhel7_pro.tgz
# yottadb_r132_x8664_rhel8_pro.tgz
# yottadb_r132_x8664_ubuntu2004_pro.tgz
# And below are the rules for picking a tarball name for a given target system (OS and architecture).
platform="${osid}"
case $arch in
x8664)
case "${osid}" in
rhel|centos)
# For x86_64 architecture and RHEL OS, we have separate tarballs for RHEL 7 and RHEL 8.
# Hence the use of "osmajorver" below in the "platform" variable.
osmajorver=`echo $osver | cut -d. -f1`
if [ 1 = `expr "$osmajorver" ">" "7"` ] ; then
platform="centos"
else
platform="rhel"
fi
# RHEL-specific releases of YottaDB for x86_64 happened only starting r1.10 so do this
# only if the requested version is not r1.00 (the only YottaDB release prior to r1.10)
elif [ "r1.00" != ${ydb_version} ]; then
platform="rhel"
fi
platform="rhel${osmajorver}"
# For centos, use the rhel tarball if one exists for the same version.
# i.e. CentOS 7 should use the RHEL 7 tarball etc.
# i.e. CentOS 8 should use the RHEL 8 tarball etc.
# Hence the "rhel|centos" usage in the above "case" block.
;;
esac
;;
debian)
# Debian-specific releases of YottaDB for x86_64 happened only after r1.24
if expr r1.24 \< "${ydb_version}" >/dev/null; then
platform="debian"
fi
armv7l)
# armv7l architecture should use the armv6l tarball if available.
arch="armv6l"
;;
ubuntu)
# Starting with r1.30, there is an Ubuntu 20.04 build where the platform is ubuntu (not linux)
# so set the platform to ubuntu only if the requested version is r1.30 or later and the
# Ubuntu version is 20.04 or later.
if expr r1.28 \< "${ydb_version}" >/dev/null; then
# If the OS major version is 20 or later, treat it as ubuntu. Otherwise, treat it as linux.
osmajorver=`echo $osver | cut -d. -f1`
if [ "${osmajorver:-0}" -gt 19 ] ; then
platform="ubuntu"
fi
fi
esac
else
# For r1.30 and older YottaDB releases, use the below logic
# Below are the tarball names for the r1.30 tarballs.
# yottadb_r130_linux_aarch64_pro.tgz
# yottadb_r130_linux_armv6l_pro.tgz
# yottadb_r130_linux_armv7l_pro.tgz
# yottadb_r130_centos8_x8664_pro.tgz
# yottadb_r130_debian10_x8664_pro.tgz
# yottadb_r130_linux_x8664_pro.tgz
# yottadb_r130_rhel7_x8664_pro.tgz
# yottadb_r130_ubuntu2004_x8664_pro.tgz
platform=`uname -s | tr '[:upper:]' '[:lower:]'`
if [ $arch = "x8664" ] ; then
# If the current architecture is x86_64 and the distribution is RHEL (including CentOS and SLES)
# or Debian then set the platform to rhel or debian (not linux) as there are specific tarballs
# for these distributions. If the distribution is Ubuntu, then set the platform to ubuntu (not linux)
# if the version is 20.04 or later as there is a specific tarball for newer versions of Ubuntu.
#
# To get the correct binary for CentOS, RHEL and SLES, we treat OS major version 7 as rhel and later versions as centos
case "${osid}" in
rhel|centos|sles)
# CentOS-specific releases of YottaDB for x86_64 happened only after r1.26
if expr r1.26 \< "${ydb_version}" >/dev/null; then
# If the OS major version is later than 7, treat it as centos. Otherwise, treat it as rhel.
osmajorver=`echo $osver | cut -d. -f1`
if [ 1 = `expr "$osmajorver" ">" "7"` ] ; then
platform="centos"
else
platform="rhel"
fi
# RHEL-specific releases of YottaDB for x86_64 happened only starting r1.10 so do this
# only if the requested version is not r1.00 (the only YottaDB release prior to r1.10)
elif [ "r1.00" != ${ydb_version} ]; then
platform="rhel"
fi
;;
debian)
# Debian-specific releases of YottaDB for x86_64 happened only after r1.24
if expr r1.24 \< "${ydb_version}" >/dev/null; then
platform="debian"
fi
;;
ubuntu)
# Starting with r1.30, there is an Ubuntu 20.04 build where the platform is ubuntu (not linux)
# so set the platform to ubuntu only if the requested version is r1.30 or later and the
# Ubuntu version is 20.04 or later.
if expr r1.28 \< "${ydb_version}" >/dev/null; then
# If the OS major version is 20 or later, treat it as ubuntu. Otherwise, treat it as linux.
osmajorver=`echo $osver | cut -d. -f1`
if [ "${osmajorver:-0}" -gt 19 ] ; then
platform="ubuntu"
fi
fi
;;
esac
fi
fi
# Note that as long as we find a tarball with "$arch" and "$platform" in the name, we pick that tarball even if it has
# a specific version in it and the target system has a lesser version of the OS installed. This is because that case is
# possible only if --force-install is specified (or else a previous block of code would have done "osallowmajorver" and
# "osallowminorver" checks and issued appropriate errors). And in that case, we assume the user knows what they are doing
# and proceed with the install.
yottadb_download_url=""
for fullfilename in $yottadb_download_urls
do
Expand Down

0 comments on commit a8139fd

Please sign in to comment.