diff options
| author | James Page <james.page@ubuntu.com> | 2016-02-26 14:00:17 +0000 |
|---|---|---|
| committer | James Page <james.page@ubuntu.com> | 2016-02-26 14:00:17 +0000 |
| commit | 832568244d6bd0c4fd9b500c2c9b4255538d92cc (patch) | |
| tree | c7fd90066835b600fcfb5ed0578a62f3d1c504d7 /hooks | |
| parent | 747cc5fccf2e657bd20c396f4d4800d60383dba8 (diff) | |
Deal with forwards compat to xenial
Diffstat (limited to 'hooks')
| -rwxr-xr-x | hooks/hooks.py | 2 | ||||
| -rwxr-xr-x[l---------] | hooks/install | 21 | ||||
| l--------- | hooks/install.real | 1 |
3 files changed, 22 insertions, 2 deletions
diff --git a/hooks/hooks.py b/hooks/hooks.py index be82558..4801dc8 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -926,7 +926,7 @@ def arm64_trusty_quirk(): ############################################################################### # Hook functions ############################################################################### -@hooks.hook('install') +@hooks.hook('install.real') def install_hook(): juju_log('Begin install hook.') execd_preinstall() diff --git a/hooks/install b/hooks/install index 9416ca6..83a9d3c 120000..100755 --- a/hooks/install +++ b/hooks/install @@ -1 +1,20 @@ -hooks.py \ No newline at end of file +#!/bin/bash +# Wrapper to deal with newer Ubuntu versions that don't have py2 installed +# by default. + +declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml') + +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 diff --git a/hooks/install.real b/hooks/install.real new file mode 120000 index 0000000..9416ca6 --- /dev/null +++ b/hooks/install.real @@ -0,0 +1 @@ +hooks.py \ No newline at end of file |
