Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Ray Milkey | 3492dc1 | 2017-10-25 10:48:35 -0700 | [diff] [blame] | 2 | # Ubuntu base build |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 3 | |
| 4 | # vim: ts=4 sw=4 sts=4 et tw=72 : |
| 5 | |
| 6 | # force any errors to cause the script and job to end in failure |
| 7 | set -xeu -o pipefail |
| 8 | |
| 9 | rh_systems() { |
| 10 | echo 'No changes to apply' |
| 11 | } |
| 12 | |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 13 | |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 14 | ubuntu_systems() { |
| 15 | apt-get clean |
Ray Milkey | 42a199f | 2018-01-08 10:19:49 -0800 | [diff] [blame] | 16 | |
| 17 | # set up docker repo |
| 18 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
Ray Milkey | 3dafd60 | 2018-01-08 09:36:55 -0800 | [diff] [blame] | 19 | sudo add-apt-repository \ |
| 20 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
| 21 | $(lsb_release -cs) \ |
| 22 | stable" |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 23 | |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 24 | apt-get update |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 25 | apt-get install -y \ |
| 26 | bzip2 \ |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 27 | chromium-browser \ |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 28 | curl \ |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 29 | docker-ce \ |
Zack Williams | f8d5dab | 2020-06-23 15:13:33 -0700 | [diff] [blame] | 30 | enchant \ |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 31 | git \ |
| 32 | less \ |
Zack Williams | 0f67597 | 2020-06-30 22:34:42 -0700 | [diff] [blame] | 33 | libxml2-utils \ |
Ray Milkey | a3809a0 | 2017-10-31 11:21:16 -0700 | [diff] [blame] | 34 | maven \ |
| 35 | nodejs \ |
| 36 | npm \ |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 37 | python \ |
Ray Milkey | 885924b | 2017-12-06 14:12:55 -0800 | [diff] [blame] | 38 | python-pip \ |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 39 | python-virtualenv \ |
| 40 | rsync \ |
| 41 | ssh \ |
| 42 | zip |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 43 | # end of apt-get install list |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 44 | |
Jeremy Ronquillo | 5de74cd | 2022-07-19 10:24:21 -0700 | [diff] [blame] | 45 | npm install -g npm@latest # update npm to latest version, since apt doesn't fetch latest |
Ray Milkey | f56c9a5 | 2017-11-21 13:29:52 -0800 | [diff] [blame] | 46 | npm install -g bower |
| 47 | npm install karma --save-dev |
Ray Milkey | 3dafd60 | 2018-01-08 09:36:55 -0800 | [diff] [blame] | 48 | |
Zack Williams | fef4927 | 2019-08-28 13:47:09 -0700 | [diff] [blame] | 49 | # clean up |
| 50 | apt-get clean |
| 51 | apt-get purge -y |
| 52 | apt-get autoremove -y |
| 53 | rm -rf /var/lib/apt/lists/* |
Sean Condon | 4eb1026 | 2020-04-30 17:42:33 +0100 | [diff] [blame] | 54 | |
pierventre | 0174557 | 2022-05-17 09:41:15 +0200 | [diff] [blame] | 55 | BAZELISK_VERSION="1.11.0" |
| 56 | BAZELISK_SHA256SUM="231ec5ca8115e94c75a1f4fbada1a062b48822ca04f21f26e4cb1cd8973cd458" |
Sean Condon | 4eb1026 | 2020-04-30 17:42:33 +0100 | [diff] [blame] | 57 | curl -L -o /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VERSION}/bazelisk-linux-amd64 |
| 58 | echo "$BAZELISK_SHA256SUM /tmp/bazelisk" | sha256sum -c - |
| 59 | mv /tmp/bazelisk /usr/local/bin/bazel |
| 60 | chmod -R a+rx /usr/local/bin/bazel |
pierventre | 0174557 | 2022-05-17 09:41:15 +0200 | [diff] [blame] | 61 | USE_BAZEL_VERSION=3.7.2 bazel version |
| 62 | USE_BAZEL_VERSION=6.0.0-pre.20220421.3 bazel version |
Sean Condon | 4eb1026 | 2020-04-30 17:42:33 +0100 | [diff] [blame] | 63 | mv ~/.cache/bazelisk /usr/local/share/ |
| 64 | chmod -R a+rw /usr/local/share/bazelisk |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 65 | } |
Kailash Khalasi | e0964b1 | 2018-07-10 09:22:00 -0700 | [diff] [blame] | 66 | |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 67 | all_systems() { |
| 68 | echo 'No common distribution configuration to perform' |
| 69 | } |
| 70 | |
| 71 | echo "---> Detecting OS" |
| 72 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 73 | |
| 74 | case "${ORIGIN}" in |
| 75 | fedora|centos|redhat) |
| 76 | echo "---> RH type system detected" |
| 77 | rh_systems |
| 78 | ;; |
| 79 | ubuntu) |
| 80 | echo "---> Ubuntu system detected" |
| 81 | ubuntu_systems |
| 82 | ;; |
| 83 | *) |
| 84 | echo "---> Unknown operating system" |
| 85 | ;; |
| 86 | esac |
| 87 | |
| 88 | # execute steps for all systems |
| 89 | all_systems |