1
- #! /bin/bash
2
- set -e
1
+ #! /usr/ bin/env bash
2
+ set -Eeuo pipefail
3
3
4
4
self=" $( basename " $BASH_SOURCE " ) "
5
5
cd " $( dirname " $( readlink -f " $BASH_SOURCE " ) " ) "
6
6
7
- # Get the most recent commit which modified any of "$@".
7
+ # get the most recent commit which modified any of "$@"
8
8
fileCommit () {
9
9
git log -1 --format=' format:%H' HEAD -- " $@ "
10
10
}
11
11
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 () {
15
14
local dir=" $1 " ; shift
16
15
(
17
- cd " $dir " ;
18
- fileCommit Dockerfile \
16
+ cd " $dir "
17
+ fileCommit \
18
+ Dockerfile \
19
19
$( git show HEAD:./Dockerfile | awk '
20
20
toupper($1) == "COPY" {
21
- for (i = 2; i < NF; i++)
22
- print $i;
21
+ for (i = 2; i < NF; i++) {
22
+ print $i
23
+ }
23
24
}
24
25
' )
25
26
)
@@ -29,16 +30,17 @@ getArches() {
29
30
local repo=" $1 " ; shift
30
31
local officialImagesUrl=' https://github.com/docker-library/official-images/raw/master/library/'
31
32
32
- eval " declare -g -A parentRepoToArches=( $(
33
+ eval " declare -A -g parentRepoToArches=( $(
33
34
find -name ' Dockerfile' -exec awk '
34
- toupper($1) == "FROM" && $2 !~ /^(' " $repo " ' |scratch|microsoft\/[^:]+ )(:|$)/ {
35
+ toupper($1) == "FROM" && $2 !~ /^(' " $repo " ' |scratch|.*\/.* )(:|$)/ {
35
36
print "' " $officialImagesUrl " ' " $2
36
37
}
37
38
' ' {}' + \
38
39
| sort -u \
39
40
| xargs bashbrew cat --format ' [{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"'
40
41
) )"
41
42
}
43
+ getArches ' phpmyadmin'
42
44
43
45
if ! command -v bashbrew --version & > /dev/null
44
46
then
47
49
exit 1
48
50
fi
49
51
50
- getArches ' phpmyadmin'
51
-
52
- # Header.
53
52
cat << -EOH
54
53
# This file is generated via https://github.com/phpmyadmin/docker/blob/$( fileCommit " $self " ) /$self
55
54
Maintainers: Isaac Bennetch <[email protected] > (@ibennetch),
@@ -67,7 +66,7 @@ join() {
67
66
latest=" $( curl -fsSL ' https://www.phpmyadmin.net/home_page/version.json' | jq -r ' .version' ) "
68
67
69
68
for variant in apache fpm fpm-alpine; do
70
- commit=" $( dockerfileCommit " $variant " ) "
69
+ commit=" $( dirCommit " $variant " ) "
71
70
fullversion=" $( git show " $commit " :" $variant /Dockerfile" | awk ' $1 == "ENV" && $2 == "VERSION" { print $3; exit }' ) "
72
71
73
72
versionAliases=( " $fullversion " " ${fullversion% .* } " " ${fullversion% .* .* } " )
0 commit comments