rh_linux_deps.sh 2.8 KB

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