#!/bin/bash
set -ex
# -*- coding: utf-8 -*-

# This file is part of Cockpit.
#
# Copyright (C) 2016 Red Hat, Inc.
#
# Cockpit is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Cockpit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.

docker pull busybox:latest
docker pull busybox:buildroot-2014.02
# docker pull submod/helloapache:0.1.11
docker pull gcr.io/google_containers/pause:2.0
docker pull gcr.io/google_containers/pause:0.8.0
docker pull gcr.io/google_containers/pause-amd64:3.0

# Disable all further pulling from online during the tests
cat >> /etc/hosts <<EOF
127.0.0.1       registry-1.docker.io
127.0.0.1       registry-2.docker.io
127.0.0.1       auth.docker.io
127.0.0.1       docker.io
127.0.0.1       gcr.io
127.0.0.1       registry.access.redhat.com
EOF

# Disable messing with /etc/hosts on systems using cloud-init
if [ -f /etc/cloud/cloud.cfg ]; then
    sed -i '/etc_hosts/d' /etc/cloud/cloud.cfg
fi
