rh_linux_deps.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. # Script for common Dockerfile dependency installation in redhat linux based images
  3. set -ex
  4. MACHINE=$(uname -m)
  5. if grep -i "centos" /etc/system-release >/dev/null; then
  6. # Centos 7 derivatives have too old of a git version to run our generate script
  7. # uninstall and ignore failures
  8. yum remove -y git
  9. yum -y install epel-release centos-release-scl
  10. yum -y install dnf
  11. if [ "${MACHINE}" = "x86_64" ]; then
  12. yum -y install https://repo.ius.io/ius-release-el7.rpm
  13. dnf install -y git236
  14. else
  15. dnf install -y rh-git227-git
  16. ln -s /opt/rh/rh-git227/root/usr/bin/git /usr/local/bin/git
  17. fi
  18. dnf install -y devtoolset-10-gcc devtoolset-10-gcc-c++
  19. elif grep -i "rocky" /etc/system-release >/dev/null; then
  20. # Temporary workaround until rocky 8 AppStream ships GCC 10.4 (10.3 is incompatible with NVCC)
  21. cat << EOF > /etc/yum.repos.d/Rocky-Vault.repo
  22. [vault]
  23. name=Rocky Vault
  24. baseurl=https://dl.rockylinux.org/vault/rocky/8.5/AppStream/\$basearch/os/
  25. gpgcheck=1
  26. enabled=1
  27. countme=1
  28. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
  29. EOF
  30. dnf install -y git \
  31. gcc-toolset-10-gcc-10.2.1-8.2.el8 \
  32. gcc-toolset-10-gcc-c++-10.2.1-8.2.el8
  33. else
  34. echo "ERROR Unexpected distro"
  35. exit 1
  36. fi
  37. if [ -n "${CMAKE_VERSION}" ]; then
  38. curl -s -L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz | tar -zx -C /usr --strip-components 1
  39. fi
  40. if [ -n "${GOLANG_VERSION}" ]; then
  41. if [ "${MACHINE}" = "x86_64" ]; then
  42. GO_ARCH="amd64"
  43. else
  44. GO_ARCH="arm64"
  45. fi
  46. mkdir -p /usr/local
  47. curl -s -L https://dl.google.com/go/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz | tar xz -C /usr/local
  48. ln -s /usr/local/go/bin/go /usr/local/bin/go
  49. ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
  50. fi