Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 44 lines (31 sloc) 941 Bytes
#!/bin/bash -ex
deps=(amulet distro-info-data python3-pip)
function check_apt_packages() {
for dep in $deps; do
if ! dpkg -l $dep 2> /dev/null | grep -q '^ii '; then
return 1
fi
done
}
function install_apt_packages() {
sudo add-apt-repository --yes ppa:juju/stable
sudo apt-get update --yes
sudo apt-get install --yes "${deps[@]}"
}
function install_python_packages() {
# Setup for the generic 010-configs amulet test
# PyMySQL not in main < Vivid, pip it instead
# Enable http proxy if AMULET_HTTP_PROXY is set, for pipping.
if [[ -n "$AMULET_HTTP_PROXY" ]]; then
export HTTP_PROXY=$AMULET_HTTP_PROXY
export HTTPS_PROXY=$(echo $AMULET_HTTP_PROXY | sed 's/http/https/g')
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTPS_PROXY
env | egrep "proxy|PROXY"
fi
sudo -E pip3 install PyMySQL
}
if ! check_apt_packages; then
install_apt_packages
fi
install_python_packages