blob: 006710769161de22ea9e51d17dc12a39b58631e0 [file] [log] [blame]
Andrew Grimberg78bc6d52017-10-13 12:55:05 -07001#!/bin/bash
Ray Milkey3492dc12017-10-25 10:48:35 -07002# Ubuntu base build
Andrew Grimberg78bc6d52017-10-13 12:55:05 -07003
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
7set -xeu -o pipefail
8
9rh_systems() {
10 echo 'No changes to apply'
11}
12
Brian O'Connor476369f2017-10-18 16:36:33 -070013
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070014ubuntu_systems() {
15 apt-get clean
Ray Milkey42a199f2018-01-08 10:19:49 -080016
17 # set up docker repo
18 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Ray Milkey3dafd602018-01-08 09:36:55 -080019 sudo add-apt-repository \
20 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
21 $(lsb_release -cs) \
22 stable"
Zack Williams3403ff42019-08-13 18:30:42 -070023
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070024 apt-get update
Brian O'Connor476369f2017-10-18 16:36:33 -070025 apt-get install -y \
26 bzip2 \
Zack Williams3403ff42019-08-13 18:30:42 -070027 chromium-browser \
Brian O'Connor476369f2017-10-18 16:36:33 -070028 curl \
Zack Williams3403ff42019-08-13 18:30:42 -070029 docker-ce \
Zack Williamsf8d5dab2020-06-23 15:13:33 -070030 enchant \
Brian O'Connor476369f2017-10-18 16:36:33 -070031 git \
32 less \
Zack Williams0f675972020-06-30 22:34:42 -070033 libxml2-utils \
Ray Milkeya3809a02017-10-31 11:21:16 -070034 maven \
35 nodejs \
36 npm \
Zack Williams3403ff42019-08-13 18:30:42 -070037 python \
Ray Milkey885924b2017-12-06 14:12:55 -080038 python-pip \
Zack Williams3403ff42019-08-13 18:30:42 -070039 python-virtualenv \
40 rsync \
41 ssh \
42 zip
Brian O'Connor476369f2017-10-18 16:36:33 -070043 # end of apt-get install list
Zack Williams3403ff42019-08-13 18:30:42 -070044
Jeremy Ronquillo5de74cd2022-07-19 10:24:21 -070045 npm install -g npm@latest # update npm to latest version, since apt doesn't fetch latest
Ray Milkeyf56c9a52017-11-21 13:29:52 -080046 npm install -g bower
47 npm install karma --save-dev
Ray Milkey3dafd602018-01-08 09:36:55 -080048
Zack Williamsfef49272019-08-28 13:47:09 -070049 # clean up
50 apt-get clean
51 apt-get purge -y
52 apt-get autoremove -y
53 rm -rf /var/lib/apt/lists/*
Sean Condon4eb10262020-04-30 17:42:33 +010054
pierventre01745572022-05-17 09:41:15 +020055 BAZELISK_VERSION="1.11.0"
56 BAZELISK_SHA256SUM="231ec5ca8115e94c75a1f4fbada1a062b48822ca04f21f26e4cb1cd8973cd458"
Sean Condon4eb10262020-04-30 17:42:33 +010057 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
pierventre01745572022-05-17 09:41:15 +020061 USE_BAZEL_VERSION=3.7.2 bazel version
62 USE_BAZEL_VERSION=6.0.0-pre.20220421.3 bazel version
Sean Condon4eb10262020-04-30 17:42:33 +010063 mv ~/.cache/bazelisk /usr/local/share/
64 chmod -R a+rw /usr/local/share/bazelisk
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070065}
Kailash Khalasie0964b12018-07-10 09:22:00 -070066
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070067all_systems() {
68 echo 'No common distribution configuration to perform'
69}
70
71echo "---> Detecting OS"
72ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
73
74case "${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 ;;
86esac
87
88# execute steps for all systems
89all_systems