blob: 97aa8482206f3742f438d6a39c209298d3de66bf [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 \
70 gitpython \
71 graphviz "Jinja2>=2.9" \
72 robotframework \
73 robotframework-sshlibrary \
74 robotframework-requests \
75 robotframework-httplibrary
76
77 # install npm modules
78 npm install -g \
79 typings
80
81 # install repo
82 curl -o /tmp/repo 'https://gerrit.opencord.org/gitweb?p=repo.git;a=blob_plain;f=repo;hb=refs/heads/stable'
83 sudo mv /tmp/repo /usr/local/bin/repo
84 sudo chmod a+x /usr/local/bin/repo
Linux Foundation Administrators1dc9dd52018-01-26 09:09:09 -080085
86 #TODO clean up
87 #apt-get clean
88 #apt-get purge -y
89 #apt-get autoremove -y
90 #rm -rf /var/lib/apt/lists/*
91 #rm -rf /var/cache/oracle-jdk8-installer
92 echo 'No changes to apply'
93}
94
95all_systems() {
96 echo 'No common distribution configuration to perform'
97}
98
99echo "---> Detecting OS"
100ORIGIN=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
101
102case "${ORIGIN}" in
103 fedora|centos|redhat)
104 echo "---> RH type system detected"
105 rh_systems
106 ;;
107 ubuntu)
108 echo "---> Ubuntu system detected"
109 ubuntu_systems
110 ;;
111 *)
112 echo "---> Unknown operating system"
113 ;;
114esac
115
116# execute steps for all systems
117all_systems