blob: d4d4e5446acdbb6c1e14babec7af1c52636bce50 [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 \
Brian O'Connor476369f2017-10-18 16:36:33 -070030 git \
31 less \
Ray Milkeya3809a02017-10-31 11:21:16 -070032 maven \
33 nodejs \
Ray Milkeyf4fa5022017-11-21 14:52:08 -080034 nodejs-legacy \
Ray Milkeya3809a02017-10-31 11:21:16 -070035 npm \
Zack Williams3403ff42019-08-13 18:30:42 -070036 python \
Ray Milkey885924b2017-12-06 14:12:55 -080037 python-pip \
Zack Williams3403ff42019-08-13 18:30:42 -070038 python-virtualenv \
39 rsync \
40 ssh \
41 zip
Brian O'Connor476369f2017-10-18 16:36:33 -070042 # end of apt-get install list
Zack Williams3403ff42019-08-13 18:30:42 -070043
Ray Milkeyf56c9a52017-11-21 13:29:52 -080044 npm install -g bower
45 npm install karma --save-dev
Ray Milkey3dafd602018-01-08 09:36:55 -080046
Zack Williamsfef49272019-08-28 13:47:09 -070047 # clean up
48 apt-get clean
49 apt-get purge -y
50 apt-get autoremove -y
51 rm -rf /var/lib/apt/lists/*
Sean Condon4eb10262020-04-30 17:42:33 +010052
53 BAZELISK_VERSION="1.4.0"
54 BAZELISK_SHA256SUM="73918095fc6ea94fa60325731412745aa5cbdd963cef1486881830158451d865"
55 curl -L -o /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VERSION}/bazelisk-linux-amd64
56 echo "$BAZELISK_SHA256SUM /tmp/bazelisk" | sha256sum -c -
57 mv /tmp/bazelisk /usr/local/bin/bazel
58 chmod -R a+rx /usr/local/bin/bazel
59 USE_BAZEL_VERSION=1.2.1 bazel version
60 USE_BAZEL_VERSION=2.0.0 bazel version
61 USE_BAZEL_VERSION=3.0.0 bazel version
62 USE_BAZEL_VERSION=3.1.0 bazel version
63 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