rh_linux_deps.sh 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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
  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. pigz
  43. else
  44. echo "ERROR Unexpected distro"
  45. exit 1
  46. fi
  47. if [ "${MACHINE}" = "x86_64" ] ; then
  48. 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 && \
  49. mv /tmp/ccache /usr/local/bin/
  50. else
  51. yum -y install epel-release
  52. yum install -y ccache
  53. fi
  54. if [ -n "${CMAKE_VERSION}" ]; then
  55. 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
  56. fi
  57. if [ -n "${GOLANG_VERSION}" ]; then
  58. if [ "${MACHINE}" = "x86_64" ]; then
  59. GO_ARCH="amd64"
  60. else
  61. GO_ARCH="arm64"
  62. fi
  63. mkdir -p /usr/local
  64. curl -s -L https://dl.google.com/go/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz | tar xz -C /usr/local
  65. ln -s /usr/local/go/bin/go /usr/local/bin/go
  66. ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
  67. fi