| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | # You may not use this file except in compliance with the License. |
| 6 | # A copy of the License is located at |
| 7 | # |
| 8 | # http://aws.amazon.com/apache2.0 |
| 9 | # |
| 10 | # or in the "license" file accompanying this file. This file is distributed |
| 11 | # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | # express or implied. See the License for the specific language governing |
| 13 | # permissions and limitations under the License. |
| 14 | # |
| 15 | |
| 16 | set -eu |
| 17 | source ./codebuild/bin/s2n_setup_env.shscip-shell source . . `./codebuild/bin/s2n_setup_env.sh`. |
| 18 | |
| 19 | al2023_mainscip-shell shell shell-project 0.0.0 al2023_main().(){ |
| 20 | case "$S2N_LIBCRYPTO" in |
| 21 | "default") echoscip-shell system . . echo. "Using default system libcrypto";; |
| 22 | *) echoscip-shell system . . echo. "${S2N_LIBCRYPTO} is not installed on this platform."; exit 1;; |
| 23 | esac |
| 24 | common_packagesscip-shell shell shell-project 0.0.0 common_packages(). |
| 25 | al2023_packagesscip-shell shell shell-project 0.0.0 al2023_packages(). |
| 26 | versionsscip-shell shell shell-project 0.0.0 versions(). |
| 27 | } |
| 28 | |
| 29 | al2_mainscip-shell shell shell-project 0.0.0 al2_main().() { |
| 30 | echoscip-shell system . . echo. "Installing AL2 packages" |
| 31 | common_packagesscip-shell shell shell-project 0.0.0 common_packages(). |
| 32 | al2_packagesscip-shell shell shell-project 0.0.0 al2_packages(). |
| 33 | symlink_all_the_thingsscip-shell shell shell-project 0.0.0 symlink_all_the_things(). |
| 34 | |
| 35 | case "$S2N_LIBCRYPTO" in |
| 36 | "openssl-1.1.1") |
| 37 | yum erase -y openssl-devel || truescip-shell system . . true. |
| 38 | yum install -y openssl11-static openssl11-libs openssl11-devel |
| 39 | ;; |
| 40 | "default") echoscip-shell system . . echo. "Using default system libcrypto";; |
| 41 | *) echoscip-shell system . . echo. "Unknown libcrypto: ${S2N_LIBCRYPTO}"; exit 1;; |
| 42 | esac |
| 43 | versionsscip-shell shell shell-project 0.0.0 versions(). |
| 44 | } |
| 45 | |
| 46 | common_packagesscip-shell shell shell-project 0.0.0 common_packages().(){ |
| 47 | # Borrowed from https://github.com/aws/aws-codebuild-docker-images/blob/master/al2/x86_64/standard/5.0/Dockerfile#L24 |
| 48 | monoscip-shell shell shell-project 0.0.0 mono(). |
| 49 | yum groupinstall -y "Development tools" |
| 50 | yum install -y clang git cmake3 iproute net-tools nettle-devel nettle which sudo psmisc |
| 51 | yum install -y python3-pip tcpdump unzip zlib-devel libtool ninja-build valgrind wget |
| 52 | rmscip-shell system . . rm. /etc/yum.repos.d/mono-centos7-stable.reposcip-shell filesystem . . `/etc/yum.repos.d/mono-centos7-stable.repo`. |
| 53 | } |
| 54 | |
| 55 | al2023_packagesscip-shell shell shell-project 0.0.0 al2023_packages().(){ |
| 56 | # Openssl 3.0 headers and go |
| 57 | yum install -y openssl-devel golang |
| 58 | # TODO: cmake isn't finding awslc https://github.com/aws/s2n-tls/issues/4633 |
| 59 | #./codebuild/bin/install_awslc.sh $(mktemp -d) /usr/local/awsc 0 |
| 60 | } |
| 61 | |
| 62 | al2_packagesscip-shell shell shell-project 0.0.0 al2_packages().() { |
| 63 | # Latest AL2 image had dependency issues related to NodeJS. |
| 64 | # We don't use NodeJS, so just remove it. |
| 65 | yum erase -y nodejs || truescip-shell system . . true. |
| 66 | yum update -y |
| 67 | yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm || truescip-shell system . . true. |
| 68 | yum install amazon-linux-extras |
| 69 | |
| 70 | # Who owns this package? It needs updating to not install modules under python2.7 |
| 71 | PYTHON=$(whichscip-shell system . . which. python2) amazon-linux-extras install -y ruby2.6 rust1 python3.8 |
| 72 | PYTHON=$(whichscip-shell system . . which. python2) amazon-linux-extras enable epel |
| 73 | PYTHON=$(whichscip-shell system . . which. python2) amazon-linux-extras enable corretto8 |
| 74 | yum install -y openssh-clients |
| 75 | } |
| 76 | |
| 77 | monoscip-shell shell shell-project 0.0.0 mono().() { |
| 78 | rpm --import https://download.mono-project.com/repo/xamarin.gpg |
| 79 | curlscip-shell system . . curl. https://download.mono-project.com/repo/centos7-stable.repo | teescip-shell system . . tee. /etc/yum.repos.d/mono-centos7-stable.reposcip-shell filesystem . . `/etc/yum.repos.d/mono-centos7-stable.repo`. |
| 80 | } |
| 81 | |
| 82 | symlink_all_the_thingsscip-shell shell shell-project 0.0.0 symlink_all_the_things().() { |
| 83 | # Package owners should be doing this. |
| 84 | # Note the version number at the end allows for upgrades to supersede these. |
| 85 | update-alternativesscip-shell system . . update-alternatives. --install /usr/bin/pipscip-shell filesystem . . `/usr/bin/pip`. pip3 /usr/bin/pip3scip-shell filesystem . . `/usr/bin/pip3`. 300 |
| 86 | update-alternativesscip-shell system . . update-alternatives. --install /usr/bin/ninjascip-shell filesystem . . `/usr/bin/ninja`. ninja /usr/bin/ninja-buildscip-shell filesystem . . `/usr/bin/ninja-build`. 170 |
| 87 | update-alternativesscip-shell system . . update-alternatives. --install /usr/bin/cmakescip-shell filesystem . . `/usr/bin/cmake`. cmake /usr/bin/cmake3scip-shell filesystem . . `/usr/bin/cmake3`. 313 |
| 88 | update-alternativesscip-shell system . . update-alternatives. --install /usr/bin/gcc-7scip-shell filesystem . . `/usr/bin/gcc-7`. gcc /usr/bin/gccscip-shell filesystem . . `/usr/bin/gcc`. 700 |
| 89 | update-alternativesscip-shell system . . update-alternatives. --install /usr/bin/g++-7scip-shell filesystem . . `/usr/bin/g++-7`. g++ /usr/bin/g++scip-shell filesystem . . `/usr/bin/g++`. 700 |
| 90 | update-alternativesscip-shell system . . update-alternatives. --install /usr/bin/g++-7scip-shell filesystem . . `/usr/bin/g++-7`. g++ /usr/bin/g++scip-shell filesystem . . `/usr/bin/g++`. 700 |
| 91 | } |
| 92 | |
| 93 | versionsscip-shell shell shell-project 0.0.0 versions().(){ |
| 94 | gccscip-shell system . . gcc. --version |
| 95 | cmakescip-shell system . . cmake. --version |
| 96 | python3scip-shell system . . python3. --version |
| 97 | } |
| 98 | |
| 99 | if [[ ${DISTRO} != "amazon linux" ]]; then |
| 100 | echoscip-shell system . . echo. "Target Amazon Linux, but running on $DISTRO: Nothing to do." |
| 101 | exit 0; |
| 102 | else |
| 103 | if [[ ${VERSION_ID} == '2' ]]; then |
| 104 | al2_mainscip-shell shell shell-project 0.0.0 al2_main().; |
| 105 | elif [[ ${VERSION_ID} == '2023' ]]; then |
| 106 | al2023_mainscip-shell shell shell-project 0.0.0 al2023_main().; |
| 107 | fi |
| 108 | fi |