rh_linux_deps.sh 2.8 KB

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