rh_linux_deps.sh 2.75 KB
Newer Older
Daniel Hiltgen's avatar
Daniel Hiltgen committed
1
2
3
4
5
#!/bin/sh

# Script for common Dockerfile dependency installation in redhat linux based images

set -ex
6
set -o pipefail
Daniel Hiltgen's avatar
Daniel Hiltgen committed
7
8
9
MACHINE=$(uname -m)

if grep -i "centos" /etc/system-release >/dev/null; then
Daniel Hiltgen's avatar
Daniel Hiltgen committed
10
11
12
13
14
    # As of 7/1/2024 mirrorlist.centos.org has been taken offline, so adjust accordingly
    sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
    sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
    sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo

Daniel Hiltgen's avatar
Daniel Hiltgen committed
15
16
17
18
    # Centos 7 derivatives have too old of a git version to run our generate script
    # uninstall and ignore failures
    yum remove -y git
    yum -y install epel-release centos-release-scl
Daniel Hiltgen's avatar
Daniel Hiltgen committed
19
20
21
22
23
24

    # The release packages reinstate the mirrors, undo that again
    sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
    sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
    sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo

Daniel Hiltgen's avatar
Daniel Hiltgen committed
25
26
27
28
29
30
31
32
    yum -y install dnf
    if [ "${MACHINE}" = "x86_64" ]; then
        yum -y install https://repo.ius.io/ius-release-el7.rpm
        dnf install -y git236
    else
        dnf install -y rh-git227-git
        ln -s /opt/rh/rh-git227/root/usr/bin/git /usr/local/bin/git
    fi
33
    dnf install -y devtoolset-10-gcc devtoolset-10-gcc-c++ pigz findutils
Daniel Hiltgen's avatar
Daniel Hiltgen committed
34
elif grep -i "rocky" /etc/system-release >/dev/null; then
35
36
37
38
39
40
41
42
43
44
45
46
    # Temporary workaround until rocky 8 AppStream ships GCC 10.4 (10.3 is incompatible with NVCC)
    cat << EOF > /etc/yum.repos.d/Rocky-Vault.repo
[vault]
name=Rocky Vault
baseurl=https://dl.rockylinux.org/vault/rocky/8.5/AppStream/\$basearch/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOF
    dnf install -y git \
        gcc-toolset-10-gcc-10.2.1-8.2.el8 \
47
        gcc-toolset-10-gcc-c++-10.2.1-8.2.el8 \
48
        findutils \
49
        pigz
Daniel Hiltgen's avatar
Daniel Hiltgen committed
50
51
52
53
54
else
    echo "ERROR Unexpected distro"
    exit 1
fi

55
56
57
58
59
60
61
62
if [ "${MACHINE}" = "x86_64" ] ; then
    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 && \
    mv /tmp/ccache /usr/local/bin/
else
    yum -y install epel-release
    yum install -y ccache
fi

Daniel Hiltgen's avatar
Daniel Hiltgen committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
if [ -n "${CMAKE_VERSION}" ]; then
    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
fi

if [ -n "${GOLANG_VERSION}" ]; then
    if [ "${MACHINE}" = "x86_64" ]; then
        GO_ARCH="amd64"
    else
        GO_ARCH="arm64"
    fi
    mkdir -p /usr/local
    curl -s -L https://dl.google.com/go/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz | tar xz -C /usr/local
    ln -s /usr/local/go/bin/go /usr/local/bin/go
    ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
fi