blob: 34c1a3bbb8aff6ebdaa931352766fd8e62897e7e [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 \
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 Administrators1dc9dd52018-01-26 09:09:09 -080088
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
98all_systems() {
99 echo 'No common distribution configuration to perform'
100}
101
102echo "---> Detecting OS"
103ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
104
105case "${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 ;;
117esac
118
119# execute steps for all systems
120all_systems