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 \ |
Jeremy Ronquillo | a4895b3 | 2022-07-19 19:37:40 +0000 | [diff] [blame] | 40 | python3-software-properties \ |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 41 | rsync \ |
| 42 | ssh \ |
| 43 | zip |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 44 | # end of apt-get install list |
Zack Williams | 3403ff4 | 2019-08-13 18:30:42 -0700 | [diff] [blame] | 45 | |
Jeremy Ronquillo | a712cdb | 2022-07-20 10:37:06 -0700 | [diff] [blame^] | 46 | npm install -g npm@latest # install latest npm, since apt installs old version (v3.5.2) |
Ray Milkey | f56c9a5 | 2017-11-21 13:29:52 -0800 | [diff] [blame] | 47 | npm install -g bower |
| 48 | npm install karma --save-dev |
Ray Milkey | 3dafd60 | 2018-01-08 09:36:55 -0800 | [diff] [blame] | 49 | |
Zack Williams | fef4927 | 2019-08-28 13:47:09 -0700 | [diff] [blame] | 50 | # clean up |
| 51 | apt-get clean |
| 52 | apt-get purge -y |
| 53 | apt-get autoremove -y |
| 54 | rm -rf /var/lib/apt/lists/* |
Sean Condon | 4eb1026 | 2020-04-30 17:42:33 +0100 | [diff] [blame] | 55 | |
pierventre | 0174557 | 2022-05-17 09:41:15 +0200 | [diff] [blame] | 56 | BAZELISK_VERSION="1.11.0" |
| 57 | BAZELISK_SHA256SUM="231ec5ca8115e94c75a1f4fbada1a062b48822ca04f21f26e4cb1cd8973cd458" |
Sean Condon | 4eb1026 | 2020-04-30 17:42:33 +0100 | [diff] [blame] | 58 | curl -L -o /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VERSION}/bazelisk-linux-amd64 |
| 59 | echo "$BAZELISK_SHA256SUM /tmp/bazelisk" | sha256sum -c - |
| 60 | mv /tmp/bazelisk /usr/local/bin/bazel |
| 61 | chmod -R a+rx /usr/local/bin/bazel |
pierventre | 0174557 | 2022-05-17 09:41:15 +0200 | [diff] [blame] | 62 | USE_BAZEL_VERSION=3.7.2 bazel version |
| 63 | USE_BAZEL_VERSION=6.0.0-pre.20220421.3 bazel version |
Sean Condon | 4eb1026 | 2020-04-30 17:42:33 +0100 | [diff] [blame] | 64 | mv ~/.cache/bazelisk /usr/local/share/ |
| 65 | chmod -R a+rw /usr/local/share/bazelisk |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 66 | } |
Kailash Khalasi | e0964b1 | 2018-07-10 09:22:00 -0700 | [diff] [blame] | 67 | |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 68 | all_systems() { |
| 69 | echo 'No common distribution configuration to perform' |
| 70 | } |
| 71 | |
| 72 | echo "---> Detecting OS" |
| 73 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 74 | |
| 75 | case "${ORIGIN}" in |
| 76 | fedora|centos|redhat) |
| 77 | echo "---> RH type system detected" |
| 78 | rh_systems |
| 79 | ;; |
| 80 | ubuntu) |
| 81 | echo "---> Ubuntu system detected" |
| 82 | ubuntu_systems |
| 83 | ;; |
| 84 | *) |
| 85 | echo "---> Unknown operating system" |
| 86 | ;; |
| 87 | esac |
| 88 | |
| 89 | # execute steps for all systems |
| 90 | all_systems |