charm-nova-lxd/hooks/install
Liam Young efd2dbcdd0 Install python-apt before hooks run
Previously this charm had relied on python-apt being installed by
the principle. As charms migrate to py3 this is no longer a safe
assumption and actually never was. This change ensures that
python-apt is installed before immediatly. This follows the same
pattern

Change-Id: I21ca95a9f2e410a52a7b64c99fad85749d52473a
2017-11-27 09:00:36 +00:00

21 lines
374 B
Bash
Executable File

#!/bin/bash
# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
# by default.
declare -a DEPS=('apt')
check_and_install() {
pkg="${1}-${2}"
if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
apt-get -y install ${pkg}
fi
}
PYTHON="python"
for dep in ${DEPS[@]}; do
check_and_install ${PYTHON} ${dep}
done
exec ./hooks/install.real