2014-08-21 01:08:35 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
declare -A gpgKeys
|
|
|
|
gpgKeys=(
|
2015-06-30 01:34:47 +02:00
|
|
|
[7.0]='1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763'
|
2015-08-07 21:01:25 +02:00
|
|
|
[5.6]='0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3'
|
|
|
|
[5.5]='0B96609E270F565C13292B24C13C70B87267B52D 0BD78B5F97500D450838F95DFE857D9A90D90EC1 F38252826ACD957EF380D39F2F7956BC5DA04B5D'
|
2014-08-21 01:08:35 +02:00
|
|
|
)
|
|
|
|
# see http://php.net/downloads.php
|
2015-07-08 18:32:37 +02:00
|
|
|
|
2014-08-21 01:08:35 +02:00
|
|
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
|
|
|
|
|
|
|
versions=( "$@" )
|
|
|
|
if [ ${#versions[@]} -eq 0 ]; then
|
|
|
|
versions=( */ )
|
|
|
|
fi
|
|
|
|
versions=( "${versions[@]%/}" )
|
|
|
|
|
|
|
|
for version in "${versions[@]}"; do
|
2015-06-30 01:47:09 +02:00
|
|
|
fullVersion=''
|
|
|
|
for comp in xz bz2; do
|
2015-12-09 01:10:11 +01:00
|
|
|
fullVersion="$(
|
|
|
|
curl -fsSL "https://secure.php.net/releases/index.php?serialize&max=100&version=${version%%.*}" \
|
|
|
|
| sed 's/;/;\n/g' \
|
|
|
|
| grep -e 'php-'"$version"'.*\.tar\.'"$comp" \
|
|
|
|
| sed -r 's/.*php-('"$version"'[^"]+)\.tar\.'"$comp"'.*/\1/' \
|
|
|
|
| sort -V \
|
|
|
|
| tail -1
|
|
|
|
)"
|
2015-06-30 01:47:09 +02:00
|
|
|
if [ "$fullVersion" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2015-12-09 01:10:11 +01:00
|
|
|
if [ -z "$fullVersion" ]; then
|
|
|
|
echo >&2 "warning: missing full version for $version; skipping"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2014-08-21 01:08:35 +02:00
|
|
|
gpgKey="${gpgKeys[$version]}"
|
|
|
|
if [ -z "$gpgKey" ]; then
|
2014-08-25 22:38:21 +02:00
|
|
|
echo >&2 "ERROR: missing GPG key fingerprint for $version"
|
2014-08-21 01:08:35 +02:00
|
|
|
echo >&2 " try looking on http://php.net/downloads.php#gpg-$version"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-07-08 18:32:37 +02:00
|
|
|
|
2014-11-07 01:41:50 +01:00
|
|
|
( set -x; cp docker-php-ext-* "$version/" )
|
|
|
|
|
|
|
|
for variant in apache fpm; do
|
2014-11-07 01:34:27 +01:00
|
|
|
echo "Generating $version/$variant/Dockerfile from $variant-Dockerfile-block-*"
|
|
|
|
awk '
|
|
|
|
$1 == "##</autogenerated>##" { ia = 0 }
|
|
|
|
!ia { print }
|
|
|
|
$1 == "##<autogenerated>##" { ia = 1; ab++; ac = 0 }
|
|
|
|
ia { ac++ }
|
|
|
|
ia && ac == 1 { system("cat '$variant'-Dockerfile-block-" ab) }
|
|
|
|
' "$version/Dockerfile" > "$version/$variant/Dockerfile"
|
2014-11-07 01:41:50 +01:00
|
|
|
( set -x; cp docker-php-ext-* "$version/$variant/" )
|
2014-11-07 01:34:27 +01:00
|
|
|
done
|
2014-09-15 19:31:14 +02:00
|
|
|
|
2015-07-08 18:32:37 +02:00
|
|
|
if [ -z "$fullVersion" ]; then
|
|
|
|
echo >&2 "ERROR: missing $version in $packagesUrl"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2014-08-21 01:08:35 +02:00
|
|
|
(
|
|
|
|
set -x
|
|
|
|
sed -ri '
|
|
|
|
s/^(ENV PHP_VERSION) .*/\1 '"$fullVersion"'/;
|
2015-04-22 22:21:14 +02:00
|
|
|
s/^(ENV GPG_KEYS) [0-9a-fA-F ]*$/\1 '"$gpgKey"'/
|
2014-12-19 09:24:48 +01:00
|
|
|
' "$version/Dockerfile" "$version/"*/Dockerfile
|
2014-08-21 01:08:35 +02:00
|
|
|
)
|
|
|
|
done
|