blob: 641322112d633ecd1e41e905bdbb4b29801de23d [file] [log] [blame]
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -08001#!/bin/bash
2# Ubuntu base build
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
7set -xeu -o pipefail
8
9rh_systems() {
10 echo 'No changes to apply'
11}
12
13ubuntu_install_java_setup() {
14 DISTRO="xenial" # TODO get this programatically
15 echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
16 echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu $DISTRO main" | \
17 tee /etc/apt/sources.list.d/webupd8team-java.list
18 echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu $DISTRO main" | \
19 tee -a /etc/apt/sources.list.d/webupd8team-java.list
20 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
21}
22
23ubuntu_systems() {
24 apt-get clean
25 ubuntu_install_java_setup
26
27 # set up docker repo
28 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
29 sudo add-apt-repository \
30 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
31 $(lsb_release -cs) \
32 stable"
33
34 apt-get update
35 apt-get install -y \
36 bzip2 \
37 curl \
38 git \
39 less \
40 oracle-java8-installer \
41 oracle-java8-set-default \
42 python \
43 ssh \
44 zip \
45 maven \
46 nodejs \
47 nodejs-legacy \
48 npm \
49 python-pip \
50 docker-ce \
51 # end of apt-get install list
52 npm install -g bower
53 npm install karma --save-dev
54
55 #TODO clean up
56 #apt-get clean
57 #apt-get purge -y
58 #apt-get autoremove -y
59 #rm -rf /var/lib/apt/lists/*
60 #rm -rf /var/cache/oracle-jdk8-installer
61 echo 'No changes to apply'
62}
63
64all_systems() {
65 echo 'No common distribution configuration to perform'
66}
67
68echo "---> Detecting OS"
69ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
70
71case "${ORIGIN}" in
72 fedora|centos|redhat)
73 echo "---> RH type system detected"
74 rh_systems
75 ;;
76 ubuntu)
77 echo "---> Ubuntu system detected"
78 ubuntu_systems
79 ;;
80 *)
81 echo "---> Unknown operating system"
82 ;;
83esac
84
85# execute steps for all systems
86all_systems