rh_linux_deps.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. dnf install -y git gcc-toolset-10-gcc gcc-toolset-10-gcc-c++
  21. else
  22. echo "ERROR Unexpected distro"
  23. exit 1
  24. fi
  25. if [ -n "${CMAKE_VERSION}" ]; then
  26. 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
  27. fi
  28. if [ -n "${GOLANG_VERSION}" ]; then
  29. if [ "${MACHINE}" = "x86_64" ]; then
  30. GO_ARCH="amd64"
  31. else
  32. GO_ARCH="arm64"
  33. fi
  34. mkdir -p /usr/local
  35. curl -s -L https://dl.google.com/go/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz | tar xz -C /usr/local
  36. ln -s /usr/local/go/bin/go /usr/local/bin/go
  37. ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
  38. fi