Skip to content

Commit

Permalink
Merge pull request #36 from opensafely-core/fix-install
Browse files Browse the repository at this point in the history
Fix docker-api-install.sh
  • Loading branch information
bloodearnest authored Oct 24, 2024
2 parents a7466ea + 3b06c2f commit 0ec53cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions docker-apt-install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# Useful utility to install system packages from a file
# It does so in the lowest footprint way possible, by removing apt lists afterwards
# It does so in the lowest footprint way possible, in a single RUN command.
set -euo pipefail

# ensure apt lists are populated
Expand All @@ -21,8 +21,12 @@ for arg in "$@"; do
fi
done

# shellcheck disable=SC2086
test -n "$PACKAGES" && apt-get install --yes --no-install-recommends $PACKAGES
if test -n "$PACKAGES"; then
# shellcheck disable=SC2086
apt-get install --yes --no-install-recommends $PACKAGES
fi

# clean up if we've upgraded
test "${UPGRADE:-}" = "yes" && apt-get autoremove --yes
if test "${UPGRADE:-}" = "yes"; then
apt-get autoremove --yes
fi
3 changes: 3 additions & 0 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ test_executable vim
test_executable strace


# test install works w/o UPDATE=yes
/root/docker-apt-install.sh make

# test script that just echos its arguments for testing
script=$(mktemp /tmp/action_exec.XXXX.sh)
chmod +x "$script"
Expand Down

0 comments on commit 0ec53cc

Please sign in to comment.