X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=env%2Fmetal3%2F01_install_package.sh;h=4d4be9f1426c64d1630ab1ebab14ae899d48e5db;hb=d97c70768d15571872233922caf17c4a4c34065b;hp=3798c0ff2649eff55e36cfc37d7ba3fc620fc1f8;hpb=aaaa10a54a1d7ec0a1c4e3a675113ec9656c0e1a;p=icn.git diff --git a/env/metal3/01_install_package.sh b/env/metal3/01_install_package.sh index 3798c0f..4d4be9f 100755 --- a/env/metal3/01_install_package.sh +++ b/env/metal3/01_install_package.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -ex +set -eux -o pipefail LIBDIR="$(dirname "$PWD")" @@ -11,108 +11,115 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -function install_essential_packages() { +function install_essential_packages { apt-get update apt-get -y install \ - crudini \ - curl \ - dnsmasq \ - figlet \ - nmap \ - patch \ - psmisc \ - python-pip \ - python-requests \ - python-setuptools \ - vim \ - wget \ - git \ - software-properties-common + crudini \ + curl \ + dnsmasq \ + figlet \ + nmap \ + patch \ + psmisc \ + python3-pip \ + python3-requests \ + python3-setuptools \ + vim \ + wget \ + git \ + software-properties-common \ + bridge-utils - add-apt-repository ppa:longsleep/golang-backports - apt-get update - apt-get install golang-go + 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 -y } -function install_ironic_packages() { +function install_ironic_packages { apt-get update apt-get -y install \ - jq \ - nodejs \ - python-ironicclient \ - python-ironic-inspector-client \ - python-lxml \ - python-netaddr \ - python-openstackclient \ - unzip \ - genisoimage + jq \ + nodejs \ + python3-ironicclient \ + python3-ironic-inspector-client \ + python3-lxml \ + python3-netaddr \ + python3-openstackclient \ + unzip \ + genisoimage \ + whois - if [ "$1" == "offline" ]; then - pip install --no-index - --find-links=file:$PIP_CACHE_DIR locat yq - return - fi + if [ "$1" == "offline" ]; then + pip install --no-index + --find-links=file:$PIP_CACHE_DIR locat yq + return + fi pip install \ - lolcat \ - yq + lolcat \ + yq } -function install_docker_packages() { +function install_docker_packages { apt-get remove docker \ - docker-engine \ - docker.io \ - containerd \ - runc + docker-engine \ + docker.io \ + containerd \ + runc apt-get update apt-get -y install \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg-agent \ - software-properties-common - if [ "$1" != "offline" ]; then - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" - apt-get update - fi + apt-transport-https \ + ca-certificates \ + curl \ + gnupg-agent \ + software-properties-common + if [ "$1" != "offline" ]; then + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" + apt-get update + fi apt-get -y install docker-ce=18.06.0~ce~3-0~ubuntu } -function install_podman_packages() { - if [ "$1" != "offline" ]; then - add-apt-repository -y ppa:projectatomic/ppa - apt-get update - fi +function install_podman_packages { + if [ "$1" != "offline" ]; then + add-apt-repository -y ppa:projectatomic/ppa + apt-get update + fi apt-get -y install podman } -function install_kubernetes_packages() { - if [ "$1" != "offline" ]; then - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - - bash -c 'cat </etc/apt/sources.list.d/kubernetes.list +function install_kubernetes_packages { + if [ "$1" != "offline" ]; then + curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - + bash -c 'cat </etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF' - apt-get update - fi - apt-get install -y kubelet=1.15.0-00 kubeadm=1.15.0-00 kubectl=1.15.0-00 - apt-mark hold kubelet kubeadm kubectl + apt-get update + fi + apt-get install -y kubelet=1.15.0-00 kubeadm=1.15.0-00 kubectl=1.15.0-00 + apt-mark hold kubelet kubeadm kubectl } install() { - install_essential_packages - install_ironic_packages $1 - install_docker_packages $1 - install_podman_packages $1 - install_kubernetes_packages $1 + install_essential_packages + install_ironic_packages $1 + + #install_docker_packages $1 + #install_podman_packages $1 + #install_kubernetes_packages $1 } -if ["$1" == "-o"]; then - install offline - exit 0 +if [ "$#" -eq 0 ]; then + install online +elif [ "$1" == "-o" ]; then + install offline +else + exit 1 fi - -install