1- #! /bin/bash
2- set -e
1+ #! /usr/ bin/env bash
2+ set -Eeuo pipefail
33
44self=" $( basename " $BASH_SOURCE " ) "
55cd " $( dirname " $( readlink -f " $BASH_SOURCE " ) " ) "
66
7- # Get the most recent commit which modified any of "$@".
7+ # get the most recent commit which modified any of "$@"
88fileCommit () {
99 git log -1 --format=' format:%H' HEAD -- " $@ "
1010}
1111
12- # Get the most recent commit which modified "$1/Dockerfile" or any file that
13- # the Dockerfile copies into the rootfs (with COPY).
14- dockerfileCommit () {
12+ # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile"
13+ dirCommit () {
1514 local dir=" $1 " ; shift
1615 (
17- cd " $dir " ;
18- fileCommit Dockerfile \
16+ cd " $dir "
17+ fileCommit \
18+ Dockerfile \
1919 $( git show HEAD:./Dockerfile | awk '
2020 toupper($1) == "COPY" {
21- for (i = 2; i < NF; i++)
22- print $i;
21+ for (i = 2; i < NF; i++) {
22+ print $i
23+ }
2324 }
2425 ' )
2526 )
@@ -29,16 +30,17 @@ getArches() {
2930 local repo=" $1 " ; shift
3031 local officialImagesUrl=' https://github.com/docker-library/official-images/raw/master/library/'
3132
32- eval " declare -g -A parentRepoToArches=( $(
33+ eval " declare -A -g parentRepoToArches=( $(
3334 find -name ' Dockerfile' -exec awk '
34- toupper($1) == "FROM" && $2 !~ /^(' " $repo " ' |scratch|microsoft\/[^:]+ )(:|$)/ {
35+ toupper($1) == "FROM" && $2 !~ /^(' " $repo " ' |scratch|.*\/.* )(:|$)/ {
3536 print "' " $officialImagesUrl " ' " $2
3637 }
3738 ' ' {}' + \
3839 | sort -u \
3940 | xargs bashbrew cat --format ' [{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
4041 ) )"
4142}
43+ getArches ' phpmyadmin'
4244
4345if ! command -v bashbrew --version & > /dev/null
4446then
4749 exit 1
4850fi
4951
50- getArches ' phpmyadmin'
51-
52- # Header.
5352cat << -EOH
5453# This file is generated via https://github.com/phpmyadmin/docker/blob/$( fileCommit " $self " ) /$self
5554Maintainers: Isaac Bennetch <[email protected] > (@ibennetch), @@ -67,7 +66,7 @@ join() {
6766latest=" $( curl -fsSL ' https://www.phpmyadmin.net/home_page/version.json' | jq -r ' .version' ) "
6867
6968for variant in apache fpm fpm-alpine; do
70- commit=" $( dockerfileCommit " $variant " ) "
69+ commit=" $( dirCommit " $variant " ) "
7170 fullversion=" $( git show " $commit " :" $variant /Dockerfile" | awk ' $1 == "ENV" && $2 == "VERSION" { print $3; exit }' ) "
7271
7372 versionAliases=( " $fullversion " " ${fullversion% .* } " " ${fullversion% .* .* } " )
0 commit comments