Skip to content

Instantly share code, notes, and snippets.

@jelaniwoods
Created April 13, 2023 14:54
Show Gist options
  • Save jelaniwoods/d5cc8157a0de0f449de748f75e2e182e to your computer and use it in GitHub Desktop.
Save jelaniwoods/d5cc8157a0de0f449de748f75e2e182e to your computer and use it in GitHub Desktop.
something to test for docker images
#!/bin/sh
set -o errexit
if [ $# = 0 ]; then
echo >&2 "No packages specified"
exit 1
fi
# Set a runlevel to avoid invoke-rc.d warnings
# http://manpages.ubuntu.com/manpages/focal/man8/runlevel.8.html#environment
RUNLEVEL=1
DEBIAN_FRONTEND=noninteractive
DAZZLE_MARKS="/var/lib/apt/dazzle-marks/"
TIMESTAMP=$(date +%s)
if [ ! -d "${DAZZLE_MARKS}" ]; then
mkdir -p "${DAZZLE_MARKS}"
fi
apt-get update
apt-get install -yq --no-install-recommends $@
cp /var/lib/dpkg/status "${DAZZLE_MARKS}/${TIMESTAMP}.status"
apt-get clean -y
rm -rf \
/var/cache/debconf/* \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment