forked from docker-library/drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-stackbrew-library.sh
executable file
·41 lines (34 loc) · 1.15 KB
/
generate-stackbrew-library.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
declare -A aliases
aliases=(
[8.0]='8 latest'
)
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( */ )
versions=( "${versions[@]%/}" )
url='git://github.com/docker-library/drupal'
echo '# maintainer: InfoSiftr <[email protected]> (@infosiftr)'
for version in "${versions[@]}"; do
for variant in apache fpm; do
commit="$(cd "$version/$variant" && git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))"
fullVersion="$(grep -m1 'ENV DRUPAL_VERSION ' "$version/$variant/Dockerfile" | cut -d' ' -f3)"
versionAliases=()
while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do
versionAliases+=( $fullVersion )
fullVersion="${fullVersion%[.-]*}"
done
versionAliases+=( $version ${aliases[$version]} )
echo
for va in "${versionAliases[@]}"; do
if [ "$va" = 'latest' ]; then
echo "$variant: ${url}@${commit} $version/$variant"
else
echo "$va-$variant: ${url}@${commit} $version/$variant"
fi
if [ "$variant" = 'apache' ]; then
echo "$va: ${url}@${commit} $version/$variant"
fi
done
done
done