blob: 5cbe77c5d6a32c5204f138d30e3b78c58ae45861 [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
Luca Prete962840a2018-03-02 16:39:23 -080013# 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 Administrators1dc9dd52018-01-26 09:09:09 -080022
23ubuntu_systems() {
24 apt-get clean
Luca Prete962840a2018-03-02 16:39:23 -080025 # ubuntu_install_java_setup
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080026
27 # set up docker repo
Luca Prete962840a2018-03-02 16:39:23 -080028 # 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 Prete31860c52018-03-06 17:54:38 -080033
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 Administrators1dc9dd52018-01-26 09:09:09 -080044 apt-get update
Luca Prete31860c52018-03-06 17:54:38 -080045
46 # install basic sofware requirements
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080047 apt-get install -y \
Luca Prete31860c52018-03-06 17:54:38 -080048 ansible \
49 apt-transport-https \
50 build-essential \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080051 bzip2 \
52 curl \
53 git \
54 less \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080055 python \
56 ssh \
57 zip \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080058 nodejs \
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080059 npm \
Luca Prete31860c52018-03-06 17:54:38 -080060 python-dev \
61 python-netaddr \
62 python-pip \
63 sshpass \
64 software-properties-common \
65 docker-ce
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080066 # end of apt-get install list
Luca Prete31860c52018-03-06 17:54:38 -080067
68 # install python modules
69 sudo pip install \
Luca Prete90bfa5e2018-03-06 20:41:56 -080070 docker==2.6.1 \
71 docker-compose==1.15.0 \
Luca Prete31860c52018-03-06 17:54:38 -080072 gitpython \
Luca Prete90bfa5e2018-03-06 20:41:56 -080073 graphviz \
74 "Jinja2>=2.9" \
Luca Prete31860c52018-03-06 17:54:38 -080075 robotframework \
76 robotframework-sshlibrary \
77 robotframework-requests \
Kailash Khalasicb327c62018-04-03 10:41:38 -070078 robotframework-httplibrary \
79 pexpect \
80 pyyaml
Luca Prete31860c52018-03-06 17:54:38 -080081
82 # install npm modules
83 npm install -g \
84 typings
85
86 # install repo
87 curl -o /tmp/repo 'https://gerrit.opencord.org/gitweb?p=repo.git;a=blob_plain;f=repo;hb=refs/heads/stable'
88 sudo mv /tmp/repo /usr/local/bin/repo
89 sudo chmod a+x /usr/local/bin/repo
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080090
91 #TODO clean up
92 #apt-get clean
93 #apt-get purge -y
94 #apt-get autoremove -y
95 #rm -rf /var/lib/apt/lists/*
96 #rm -rf /var/cache/oracle-jdk8-installer
97 echo 'No changes to apply'
98}
99
100all_systems() {
101 echo 'No common distribution configuration to perform'
102}
103
104echo "---> Detecting OS"
105ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
106
107case "${ORIGIN}" in
108 fedora|centos|redhat)
109 echo "---> RH type system detected"
110 rh_systems
111 ;;
112 ubuntu)
113 echo "---> Ubuntu system detected"
114 ubuntu_systems
115 ;;
116 *)
117 echo "---> Unknown operating system"
118 ;;
119esac
120
121# execute steps for all systems
122all_systems