blob: 6946432428c22a447cf21c7d50845cada31d27b3 [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 \
Jeremy Ronquilloa4895b32022-07-19 19:37:40 +000040 python3-software-properties \
Zack Williams3403ff42019-08-13 18:30:42 -070041 rsync \
42 ssh \
43 zip
Brian O'Connor476369f2017-10-18 16:36:33 -070044 # end of apt-get install list
Zack Williams3403ff42019-08-13 18:30:42 -070045
Jeremy Ronquilloa712cdb2022-07-20 10:37:06 -070046 npm install -g npm@latest # install latest npm, since apt installs old version (v3.5.2)
Ray Milkeyf56c9a52017-11-21 13:29:52 -080047 npm install -g bower
48 npm install karma --save-dev
Ray Milkey3dafd602018-01-08 09:36:55 -080049
Zack Williamsfef49272019-08-28 13:47:09 -070050 # clean up
51 apt-get clean
52 apt-get purge -y
53 apt-get autoremove -y
54 rm -rf /var/lib/apt/lists/*
Sean Condon4eb10262020-04-30 17:42:33 +010055
pierventre01745572022-05-17 09:41:15 +020056 BAZELISK_VERSION="1.11.0"
57 BAZELISK_SHA256SUM="231ec5ca8115e94c75a1f4fbada1a062b48822ca04f21f26e4cb1cd8973cd458"
Sean Condon4eb10262020-04-30 17:42:33 +010058 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
pierventre01745572022-05-17 09:41:15 +020062 USE_BAZEL_VERSION=3.7.2 bazel version
63 USE_BAZEL_VERSION=6.0.0-pre.20220421.3 bazel version
Sean Condon4eb10262020-04-30 17:42:33 +010064 mv ~/.cache/bazelisk /usr/local/share/
65 chmod -R a+rw /usr/local/share/bazelisk
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070066}
Kailash Khalasie0964b12018-07-10 09:22:00 -070067
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070068all_systems() {
69 echo 'No common distribution configuration to perform'
70}
71
72echo "---> Detecting OS"
73ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
74
75case "${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 ;;
87esac
88
89# execute steps for all systems
90all_systems