Files
bash/apply-templates.sh
Tianon Gravi 4811b83a9b Update all versions to Alpine 3.21
This also includes support for per-version patches, and converts some hacky code we had for devel to a proper patch file.

My intent is to keep all these patches minimal -- any non-minimal patching (especially anything beyond "make it compile successfully") will likely be grounds for no longer supporting a given version.

Almost all of these patches are cobbled together from later commits in Bash upstream (ie, backported fixes).  Only one or two are actually pure-Tianon creations (and those are just `#include <something.h>`).
2024-12-10 16:55:58 -08:00

45 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
[ -f versions.json ] # run "versions.sh" first
jqt='.jq-template.awk'
if [ -n "${BASHBREW_SCRIPTS:-}" ]; then
jqt="$BASHBREW_SCRIPTS/jq-template.awk"
elif [ "$BASH_SOURCE" -nt "$jqt" ]; then
# https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk
wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk'
fi
if [ "$#" -eq 0 ]; then
versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)"
eval "set -- $versions"
fi
generated_warning() {
cat <<-EOH
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
EOH
}
for version; do
export version
echo "processing $version ..."
patches="$(cd "$version" && find -maxdepth 1 -name '*.patch' -type f | LC_ALL=C sort)"
export patches
{
generated_warning
gawk -f "$jqt" Dockerfile.template
} > "$version/Dockerfile"
cp -a docker-entrypoint.sh "$version/"
done