Let kubespray install the correct docker versions
[icn.git] / env / metal3 / 01_install_package.sh
1 #!/usr/bin/env bash
2 set -eux -o pipefail
3
4 LIBDIR="$(dirname "$PWD")"
5
6 source $LIBDIR/lib/common.sh
7 source $LIBDIR/lib/logging.sh
8
9 if [[ $EUID -ne 0 ]]; then
10     echo "This script must be run as root"
11     exit 1
12 fi
13
14 function install_essential_packages {
15     apt-get update
16     apt-get -y install \
17     crudini \
18     curl \
19     dnsmasq \
20     figlet \
21     nmap \
22     patch \
23     psmisc \
24     python3-pip \
25     python3-requests \
26     python3-setuptools \
27     vim \
28     wget \
29     git \
30     software-properties-common \
31     bridge-utils
32
33     update-alternatives --install /usr/bin/python python /usr/bin/python3 1
34     update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
35
36     add-apt-repository -y ppa:longsleep/golang-backports
37     apt-get update
38     apt-get install golang-go -y
39 }
40
41 function install_ironic_packages {
42     apt-get update
43     apt-get -y install \
44     jq \
45     nodejs \
46     python3-ironicclient \
47     python3-ironic-inspector-client \
48     python3-lxml \
49     python3-netaddr \
50     python3-openstackclient \
51     unzip \
52     genisoimage \
53     whois
54
55     if [ "$1" == "offline" ]; then
56     pip install --no-index
57         --find-links=file:$PIP_CACHE_DIR locat yq
58     return
59     fi
60
61     pip install \
62     lolcat \
63     yq
64 }
65
66 install() {
67     install_essential_packages
68     install_ironic_packages $1
69 }
70
71 if [ "$#" -eq 0 ]; then
72     install online
73 elif [ "$1" == "-o" ]; then
74     install offline
75 else
76     exit 1
77 fi