rh_linux_deps.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. # As of 7/1/2024 mirrorlist.centos.org has been taken offline, so adjust accordingly
  7. sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
  8. sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
  9. sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
  10. # Centos 7 derivatives have too old of a git version to run our generate script
  11. # uninstall and ignore failures
  12. yum remove -y git
  13. yum -y install epel-release centos-release-scl
  14. # The release packages reinstate the mirrors, undo that again
  15. sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
  16. sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
  17. sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
  18. yum -y install dnf
  19. if [ "${MACHINE}" = "x86_64" ]; then
  20. yum -y install https://repo.ius.io/ius-release-el7.rpm
  21. dnf install -y git236
  22. else
  23. dnf install -y rh-git227-git
  24. ln -s /opt/rh/rh-git227/root/usr/bin/git /usr/local/bin/git
  25. fi
  26. dnf install -y devtoolset-10-gcc devtoolset-10-gcc-c++
  27. elif grep -i "rocky" /etc/system-release >/dev/null; then
  28. # Temporary workaround until rocky 8 AppStream ships GCC 10.4 (10.3 is incompatible with NVCC)
  29. cat << EOF > /etc/yum.repos.d/Rocky-Vault.repo
  30. [vault]
  31. name=Rocky Vault
  32. baseurl=https://dl.rockylinux.org/vault/rocky/8.5/AppStream/\$basearch/os/
  33. gpgcheck=1
  34. enabled=1
  35. countme=1
  36. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
  37. EOF
  38. dnf install -y git \
  39. gcc-toolset-10-gcc-10.2.1-8.2.el8 \
  40. gcc-toolset-10-gcc-c++-10.2.1-8.2.el8
  41. else
  42. echo "ERROR Unexpected distro"
  43. exit 1
  44. fi
  45. if [ -n "${CMAKE_VERSION}" ]; then
  46. 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
  47. fi
  48. if [ -n "${GOLANG_VERSION}" ]; then
  49. if [ "${MACHINE}" = "x86_64" ]; then
  50. GO_ARCH="amd64"
  51. else
  52. GO_ARCH="arm64"
  53. fi
  54. mkdir -p /usr/local
  55. curl -s -L https://dl.google.com/go/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz | tar xz -C /usr/local
  56. ln -s /usr/local/go/bin/go /usr/local/bin/go
  57. ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
  58. fi