Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Ray Milkey | 3492dc1 | 2017-10-25 10:48:35 -0700 | [diff] [blame] | 2 | # Ubuntu base build |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 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 |
| 7 | set -xeu -o pipefail |
| 8 | |
| 9 | rh_systems() { |
| 10 | echo 'No changes to apply' |
| 11 | } |
| 12 | |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 13 | ubuntu_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 | |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 23 | ubuntu_systems() { |
| 24 | apt-get clean |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 25 | ubuntu_install_java_setup |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 26 | apt-get update |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 27 | apt-get install -y \ |
| 28 | bzip2 \ |
| 29 | curl \ |
| 30 | git \ |
| 31 | less \ |
| 32 | oracle-java8-installer \ |
| 33 | oracle-java8-set-default \ |
| 34 | python \ |
| 35 | ssh \ |
| 36 | zip \ |
Ray Milkey | a3809a0 | 2017-10-31 11:21:16 -0700 | [diff] [blame^] | 37 | maven \ |
| 38 | nodejs \ |
| 39 | npm \ |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 40 | # end of apt-get install list |
Brian O'Connor | 476369f | 2017-10-18 16:36:33 -0700 | [diff] [blame] | 41 | #TODO clean up |
| 42 | #apt-get clean |
| 43 | #apt-get purge -y |
| 44 | #apt-get autoremove -y |
| 45 | #rm -rf /var/lib/apt/lists/* |
| 46 | #rm -rf /var/cache/oracle-jdk8-installer |
Andrew Grimberg | 78bc6d5 | 2017-10-13 12:55:05 -0700 | [diff] [blame] | 47 | echo 'No changes to apply' |
| 48 | } |
| 49 | |
| 50 | all_systems() { |
| 51 | echo 'No common distribution configuration to perform' |
| 52 | } |
| 53 | |
| 54 | echo "---> Detecting OS" |
| 55 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 56 | |
| 57 | case "${ORIGIN}" in |
| 58 | fedora|centos|redhat) |
| 59 | echo "---> RH type system detected" |
| 60 | rh_systems |
| 61 | ;; |
| 62 | ubuntu) |
| 63 | echo "---> Ubuntu system detected" |
| 64 | ubuntu_systems |
| 65 | ;; |
| 66 | *) |
| 67 | echo "---> Unknown operating system" |
| 68 | ;; |
| 69 | esac |
| 70 | |
| 71 | # execute steps for all systems |
| 72 | all_systems |