promenade/tools/setup_gate.sh
Scott Hussey c52027332f Update gate for Ubuntu 18.04 and proxy
- Remove apt conf for proxy, rely on environment
- Update schema to correctly support no_proxy
- Update build-image stage to support a proxy

Change-Id: Ie07a72ad35fde57596af88f838c8c1836b1e8510
2018-04-24 14:11:14 -05:00

65 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
SCRIPT_DIR=$(realpath "$(dirname "${0}")")
WORKSPACE=$(realpath "${SCRIPT_DIR}/..")
GATE_UTILS=${WORKSPACE}/tools/g2/lib/all.sh
GATE_COLOR=${GATE_COLOR:-1}
export GATE_COLOR
export GATE_UTILS
export WORKSPACE
source "${GATE_UTILS}"
REQUIRE_RELOG=0
log_stage_header "Installing Packages"
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -qq
sudo apt-get install -q -y --no-install-recommends \
curl \
docker.io \
fio \
genisoimage \
jq \
libstring-shellquote-perl \
libvirt-bin \
qemu-kvm \
qemu-utils \
virtinst
log_stage_header "Joining User Groups"
for grp in docker libvirtd libvirt; do
if ! groups | grep $grp > /dev/null; then
sudo adduser "$(id -un)" $grp || echo "Group $grp not found, not added to user"
REQUIRE_RELOG=1
fi
done
log_stage_header "Setting Kernel Parameters"
if [ "xY" != "x$(cat /sys/module/kvm_intel/parameters/nested)" ]; then
log_note Enabling nested virtualization.
sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1
echo "options kvm-intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf
fi
if ! sudo virt-host-validate qemu &> /dev/null; then
log_note Host did not validate virtualization check:
sudo virt-host-validate qemu || true
fi
if [[ ! -d ${VIRSH_POOL_PATH} ]]; then
sudo mkdir -p "${VIRSH_POOL_PATH}"
fi
if [[ ${REQUIRE_RELOG} -eq 1 ]]; then
echo
log_note "You must ${C_HEADER}log out${C_CLEAR} and back in before the gate is ready to run."
fi
log_huge_success