Update to python3
[icn.git] / env / metal3 / 01_install_package.sh
index 8aa458f..4d4be9f 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-set -ex
+set -eux -o pipefail
 
 LIBDIR="$(dirname "$PWD")"
 
@@ -21,18 +21,21 @@ function install_essential_packages {
     nmap \
     patch \
     psmisc \
-    python-pip \
-    python-requests \
-    python-setuptools \
+    python3-pip \
+    python3-requests \
+    python3-setuptools \
     vim \
     wget \
     git \
     software-properties-common \
     bridge-utils
 
+    update-alternatives --install /usr/bin/python python /usr/bin/python3 1
+    update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
+
     add-apt-repository -y ppa:longsleep/golang-backports
     apt-get update
-    apt-get install golang-go
+    apt-get install golang-go -y
 }
 
 function install_ironic_packages {
@@ -40,13 +43,14 @@ function install_ironic_packages {
     apt-get -y install \
     jq \
     nodejs \
-    python-ironicclient \
-    python-ironic-inspector-client \
-    python-lxml \
-    python-netaddr \
-    python-openstackclient \
+    python3-ironicclient \
+    python3-ironic-inspector-client \
+    python3-lxml \
+    python3-netaddr \
+    python3-openstackclient \
     unzip \
-    genisoimage
+    genisoimage \
+    whois
 
     if [ "$1" == "offline" ]; then
     pip install --no-index
@@ -106,14 +110,16 @@ EOF'
 install() {
     install_essential_packages
     install_ironic_packages $1
-    install_docker_packages $1
-    install_podman_packages $1
-    install_kubernetes_packages $1
+
+    #install_docker_packages $1
+    #install_podman_packages $1
+    #install_kubernetes_packages $1
 }
 
-if ["$1" == "-o"]; then
+if [ "$#" -eq 0 ]; then
+    install online
+elif [ "$1" == "-o" ]; then
     install offline
-    exit 0
+else
+    exit 1
 fi
-
-install