diff options
author | Sam Pearson <sam@sgp.me.uk> | 2020-02-12 16:39:18 +0000 |
---|---|---|
committer | Sam Pearson <sam@sgp.me.uk> | 2020-03-03 09:20:46 +0000 |
commit | 2baa60e1d41c88a69246732fbbef36167d367ea5 (patch) | |
tree | 9b1874e833c830017ecd3fd95293efebf9b536a1 | |
parent | d65ce0e6b24c8302db4107290d12d8e7d5c864b9 (diff) |
[script/bootstrap] Keep OS packages updated in development environments
This adds a script, `bin/install_packages`, that will install packages
listed in versions of `conf/packages*` and calls it from the bootstrap
script in a way appropriate to the environment it is being run under.
This should ensure that, for example, changes to dependencies will be
applied to Vagrant machines in-between tagged releases.
The default packages file used will be `packages.generic`.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rwxr-xr-x | bin/install_packages | 13 | ||||
-rwxr-xr-x | script/bootstrap | 10 |
3 files changed, 24 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d7a5714b..437f48656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ - Add configuration for setting Content-Security-Policy header. - Add banner on staging website/emails, and STAGING_FLAGS option to hide it. - Do not hard code site name in database fixture. + - Ensure OS dependencies are kept updated in development environments. - Open311 improvements: - Support use of 'private' service definition <keywords> to mark reports made in that category private. #2488 diff --git a/bin/install_packages b/bin/install_packages new file mode 100755 index 000000000..7b4bfd8e1 --- /dev/null +++ b/bin/install_packages @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +PACKAGE_FILE=conf/packages + +[ -n "$1" ] && PACKAGE_FILE="conf/packages.${1}" + +apt-get update + +grep -v ^# $PACKAGE_FILE | grep -v ^$ | xargs apt-get install -qq -y + diff --git a/script/bootstrap b/script/bootstrap index dfebd7449..5345b163e 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -4,4 +4,14 @@ set -e cd "$(dirname "$0")/.." git submodule --quiet update --init --recursive --rebase + +# Let's see if we can't work out where we might be running. +if cut -d/ -f2 /proc/self/cgroup | sort -u | grep -q docker ; then + # Docker + sudo bin/install_packages docker +else + # Fallback + sudo bin/install_packages generic +fi + bin/install_perl_modules |