Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 1 | #!/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 |
| 7 | set -xeu -o pipefail |
| 8 | |
| 9 | rh_systems() { |
| 10 | echo 'No changes to apply' |
| 11 | } |
| 12 | |
Luca Prete | 962840a | 2018-03-02 16:39:23 -0800 | [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 | # } |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 22 | |
| 23 | ubuntu_systems() { |
| 24 | apt-get clean |
Luca Prete | 962840a | 2018-03-02 16:39:23 -0800 | [diff] [blame] | 25 | # ubuntu_install_java_setup |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 26 | |
| 27 | # set up docker repo |
Luca Prete | 962840a | 2018-03-02 16:39:23 -0800 | [diff] [blame] | 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" |
Luca Prete | 31860c5 | 2018-03-06 17:54:38 -0800 | [diff] [blame] | 33 | |
| 34 | # set up ansible repo |
| 35 | sudo apt-add-repository -y ppa:ansible/ansible |
| 36 | |
| 37 | # set up docker repo |
| 38 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 39 | sudo add-apt-repository \ |
| 40 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
| 41 | $(lsb_release -cs) \ |
| 42 | stable" |
| 43 | |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 44 | apt-get update |
Luca Prete | 31860c5 | 2018-03-06 17:54:38 -0800 | [diff] [blame] | 45 | |
| 46 | # install basic sofware requirements |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 47 | apt-get install -y \ |
Luca Prete | 31860c5 | 2018-03-06 17:54:38 -0800 | [diff] [blame] | 48 | ansible \ |
| 49 | apt-transport-https \ |
| 50 | build-essential \ |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 51 | bzip2 \ |
| 52 | curl \ |
| 53 | git \ |
| 54 | less \ |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 55 | python \ |
| 56 | ssh \ |
| 57 | zip \ |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 58 | nodejs \ |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 59 | npm \ |
Luca Prete | 31860c5 | 2018-03-06 17:54:38 -0800 | [diff] [blame] | 60 | python-dev \ |
| 61 | python-netaddr \ |
| 62 | python-pip \ |
| 63 | sshpass \ |
| 64 | software-properties-common \ |
| 65 | docker-ce |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 66 | # end of apt-get install list |
Luca Prete | 31860c5 | 2018-03-06 17:54:38 -0800 | [diff] [blame] | 67 | |
| 68 | # install python modules |
| 69 | sudo pip install \ |
Luca Prete | 90bfa5e | 2018-03-06 20:41:56 -0800 | [diff] [blame] | 70 | docker==2.6.1 \ |
| 71 | docker-compose==1.15.0 \ |
Luca Prete | 31860c5 | 2018-03-06 17:54:38 -0800 | [diff] [blame] | 72 | gitpython \ |
Luca Prete | 90bfa5e | 2018-03-06 20:41:56 -0800 | [diff] [blame] | 73 | graphviz \ |
| 74 | "Jinja2>=2.9" \ |
Luca Prete | 31860c5 | 2018-03-06 17:54:38 -0800 | [diff] [blame] | 75 | robotframework \ |
| 76 | robotframework-sshlibrary \ |
| 77 | robotframework-requests \ |
| 78 | robotframework-httplibrary |
| 79 | |
| 80 | # install npm modules |
| 81 | npm install -g \ |
| 82 | typings |
| 83 | |
| 84 | # install repo |
| 85 | curl -o /tmp/repo 'https://gerrit.opencord.org/gitweb?p=repo.git;a=blob_plain;f=repo;hb=refs/heads/stable' |
| 86 | sudo mv /tmp/repo /usr/local/bin/repo |
| 87 | sudo chmod a+x /usr/local/bin/repo |
Linux Foundation Administrators | 1dc9dd5 | 2018-01-26 09:09:09 -0800 | [diff] [blame] | 88 | |
| 89 | #TODO clean up |
| 90 | #apt-get clean |
| 91 | #apt-get purge -y |
| 92 | #apt-get autoremove -y |
| 93 | #rm -rf /var/lib/apt/lists/* |
| 94 | #rm -rf /var/cache/oracle-jdk8-installer |
| 95 | echo 'No changes to apply' |
| 96 | } |
| 97 | |
| 98 | all_systems() { |
| 99 | echo 'No common distribution configuration to perform' |
| 100 | } |
| 101 | |
| 102 | echo "---> Detecting OS" |
| 103 | ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]') |
| 104 | |
| 105 | case "${ORIGIN}" in |
| 106 | fedora|centos|redhat) |
| 107 | echo "---> RH type system detected" |
| 108 | rh_systems |
| 109 | ;; |
| 110 | ubuntu) |
| 111 | echo "---> Ubuntu system detected" |
| 112 | ubuntu_systems |
| 113 | ;; |
| 114 | *) |
| 115 | echo "---> Unknown operating system" |
| 116 | ;; |
| 117 | esac |
| 118 | |
| 119 | # execute steps for all systems |
| 120 | all_systems |