mirror of
https://github.com/EpicMorg/docker-scripts.git
synced 2024-12-26 22:55:44 +03:00
27 lines
796 B
Bash
27 lines
796 B
Bash
|
#!/bin/bash
|
||
|
set -e
|
||
|
|
||
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||
|
|
||
|
versions=( "$@" )
|
||
|
if [ ${#versions[@]} -eq 0 ]; then
|
||
|
versions=( */ )
|
||
|
fi
|
||
|
versions=( "${versions[@]%/}" )
|
||
|
|
||
|
packagesUrl='http://apt.postgresql.org/pub/repos/apt/dists/wheezy-pgdg/main/binary-amd64/Packages'
|
||
|
packages="$(echo "$packagesUrl" | sed -r 's/[^a-zA-Z.-]+/-/g')"
|
||
|
curl -sSL "${packagesUrl}.bz2" | bunzip2 > "$packages"
|
||
|
|
||
|
for version in "${versions[@]}"; do
|
||
|
fullVersion="$(grep -m1 -A10 "^Package: postgresql-$version\$" "$packages" | grep -m1 '^Version: ' | cut -d' ' -f2)"
|
||
|
(
|
||
|
set -x
|
||
|
cp docker-entrypoint.sh Dockerfile.template "$version/"
|
||
|
mv "$version/Dockerfile.template" "$version/Dockerfile"
|
||
|
sed -i 's/%%PG_MAJOR%%/'$version'/g; s/%%PG_VERSION%%/'$fullVersion'/g' "$version/Dockerfile"
|
||
|
)
|
||
|
done
|
||
|
|
||
|
rm "$packages"
|