1
0
mirror of https://github.com/docker-library/postgres.git synced 2025-11-17 13:02:40 +03:00
Files
postgres/generate-stackbrew-library.sh
2016-01-07 10:27:31 -08:00

27 lines
752 B
Bash
Executable File

#!/bin/bash
set -e
declare -A aliases
aliases=(
[9.5]='9 latest'
)
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( */ )
versions=( "${versions[@]%/}" )
url='git://github.com/docker-library/postgres'
echo '# maintainer: InfoSiftr <github@infosiftr.com> (@infosiftr)'
for version in "${versions[@]}"; do
commit="$(cd "$version" && git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))"
fullVersion="$(grep -m1 'ENV PG_VERSION ' "$version/Dockerfile" | cut -d' ' -f3 | cut -d- -f1 | sed 's/~/-/g')"
versionAliases=( $fullVersion $version ${aliases[$version]} )
echo
for va in "${versionAliases[@]}"; do
echo "$va: ${url}@${commit} $version"
done
done