5 source $(dirname $PWD)/../lib/common.sh
6 source $(dirname $PWD)/../lib/logging.sh
8 if [[ $EUID -ne 0 ]]; then
9 echo "This script must be run as root"
13 if [[ $(lsb_release -d | cut -f2) != $UBUNTU_BIONIC ]]; then
14 echo "Currently Ubuntu 18.04.2 LTS is only supported"
18 function download_essential_packages {
20 for package in crudini curl dnsmasq figlet golang nmap patch psmisc \
21 python3-pip python3-requests python3-setuptools vim wget; do
22 apt-get -d install $package -y
24 update-alternatives --install /usr/bin/python python /usr/bin/python3 1
25 update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
28 function download_container_images {
30 pushd $CONTAINER_IMAGES_DIR
31 #docker images for Kubernetes
32 for images in kube-apiserver kube-controller-manager kube-scheduler kube-proxy; do
33 docker pull k8s.gcr.io/$images:v1.15.0;
34 docker save --output $images.tar k8s.gcr.io/$images;
37 docker pull k8s.gcr.io/pause:3.1
38 docker save --output pause.tar k8s.gcr.io/pause
40 docker pull k8s.gcr.io/etcd:3.3.10
41 docker save --output etcd.tar k8s.gcr.io/etcd
43 docker pull k8s.gcr.io/coredns:1.3.1
44 docker save --output coredns.tar k8s.gcr.io/coredns
49 function download_build_packages {
52 if [ ! -f ironic-python-agent.initramfs ]; then
53 curl --insecure --compressed \
54 -L https://images.rdoproject.org/train/rdo_trunk/current-tripleo/ironic-python-agent.tar | tar -xf -
57 if [[ "$BM_IMAGE_URL" && "$BM_IMAGE" ]]; then
58 curl -o ${BM_IMAGE} --insecure --compressed -O -L ${BM_IMAGE_URL}
59 md5sum ${BM_IMAGE} | awk '{print $1}' > ${BM_IMAGE}.md5sum
62 if [ ! -d baremetal-operator ]; then
63 git clone https://github.com/metal3-io/baremetal-operator.git
64 pushd ./baremetal-operator
65 git checkout -b icn_baremetal_operator 11ea02ab5cab8b3ab14972ae7c0e70206bba00b5
69 if [ ! -d ironic-inspector-image ]; then
70 git clone https://github.com/metal3-io/ironic-inspector-image.git
71 pushd ./ironic-inspector-image
72 git checkout -b icn_ironic_inspector_image 25431bd5b7fc87c6f3cfb8b0431fe66b86bbab0e
76 if [ ! -d ironic-image ]; then
77 git clone https://github.com/metal3-io/ironic-image.git
79 git checkout -b icn_ironic_image 329eb4542f0d8d0f0e9cf0d7e550e33b07efe7fb
86 apt-get install python3-pip -y
88 update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
92 if ! which curl ; then
93 apt-get install curl -y
97 function check_apt_tools {
98 if ! which add-apt-repository ; then
99 apt-get install software-properties-common -y
103 function download_ironic_packages {
104 for package in jq nodejs python3-ironicclient \
105 python3-ironic-inspector-client python3-lxml python3-netaddr \
106 python3-openstackclient unzip genisoimage; do
107 apt-get -d install $package -y
111 pip download lolcat yq -d $PIP_CACHE_DIR
114 function check_docker {
115 if which docker ; then
119 apt-get remove -y docker \
126 for package in apt-transport-https ca-certificates gnupg-agent \
127 software-properties-common; do
128 apt-get -d install $package -y
133 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
135 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
139 apt-get install docker-ce=19.03.15~3-0~ubuntu-bionic -y
142 function download_docker_packages {
143 apt-get remove -y docker \
150 for package in apt-transport-https ca-certificates gnupg-agent \
151 software-properties-common; do
152 apt-get -d install $package -y
157 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
159 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
163 apt-get -d install docker-ce=19.03.15~3-0~ubuntu-bionic -y
166 function download_kubernetes_packages {
167 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
168 bash -c 'cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
169 deb https://apt.kubernetes.io/ kubernetes-xenial main
172 apt-get install -d kubelet=1.15.0-00 kubeadm=1.15.0-00 kubectl=1.15.0-00 -y
175 function clean_apt_cache {
176 pushd /var/cache/apt/archives
178 if [ $(ls -1q . | wc -l ) -ge 3 ]; then
179 $(rm !("lock"|"partial"))
185 function mv_apt_cache {
186 pushd /var/cache/apt/archives
188 if [ $(ls -1q . | wc -l ) -gt 2 ]; then
189 $(mv !("lock"|"partial") $LOCAL_APT_REPO)
203 if [ $(ls -1q . | wc -l ) -ne 0 ]; then
210 check_dir $LOCAL_APT_REPO
211 clean_dir $LOCAL_APT_REPO
212 check_dir $PIP_CACHE_DIR
213 clean_dir $PIP_CACHE_DIR
216 check_dir $CONTAINER_IMAGES_DIR
217 clean_dir $CONTAINER_IMAGES_DIR
218 download_essential_packages
219 download_ironic_packages
220 download_docker_packages
221 download_kubernetes_packages
222 download_build_packages
223 download_container_images