blob: 46228702ffa97c8e2a8951790457915719bbc083 [file] [log] [blame]
Andrew Grimberg78bc6d52017-10-13 12:55:05 -07001#!/bin/bash
2
3# vim: ts=4 sw=4 sts=4 et tw=72 :
4
5# force any errors to cause the script and job to end in failure
6set -xeu -o pipefail
7
8rh_systems() {
9 echo 'No changes to apply'
10}
11
Brian O'Connor476369f2017-10-18 16:36:33 -070012ubuntu_install_java_setup() {
13 DISTRO="xenial" # TODO get this programatically
14 echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
15 echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu $DISTRO main" | \
16 tee /etc/apt/sources.list.d/webupd8team-java.list
17 echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu $DISTRO main" | \
18 tee -a /etc/apt/sources.list.d/webupd8team-java.list
19 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
20}
21
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070022ubuntu_systems() {
23 apt-get clean
Brian O'Connor476369f2017-10-18 16:36:33 -070024 ubuntu_install_java_setup
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070025 apt-get update
Brian O'Connor476369f2017-10-18 16:36:33 -070026 apt-get install -y \
27 bzip2 \
28 curl \
29 git \
30 less \
31 oracle-java8-installer \
32 oracle-java8-set-default \
33 python \
34 ssh \
35 zip \
36 # end of apt-get install list
37
38 #TODO clean up
39 #apt-get clean
40 #apt-get purge -y
41 #apt-get autoremove -y
42 #rm -rf /var/lib/apt/lists/*
43 #rm -rf /var/cache/oracle-jdk8-installer
Andrew Grimberg78bc6d52017-10-13 12:55:05 -070044 echo 'No changes to apply'
45}
46
47all_systems() {
48 echo 'No common distribution configuration to perform'
49}
50
51echo "---> Detecting OS"
52ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
53
54case "${ORIGIN}" in
55 fedora|centos|redhat)
56 echo "---> RH type system detected"
57 rh_systems
58 ;;
59 ubuntu)
60 echo "---> Ubuntu system detected"
61 ubuntu_systems
62 ;;
63 *)
64 echo "---> Unknown operating system"
65 ;;
66esac
67
68# execute steps for all systems
69all_systems