-
Notifications
You must be signed in to change notification settings - Fork 610
Expand file tree
/
Copy pathgenerate-stackbrew-library.sh
More file actions
executable file
·58 lines (49 loc) · 1.36 KB
/
generate-stackbrew-library.sh
File metadata and controls
executable file
·58 lines (49 loc) · 1.36 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
set -eu
self="$(basename "$BASH_SOURCE")"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
commit="$(git log -1 --format='format:%H' HEAD -- '[^.]*/**')"
selfCommit="$(git log -1 --format='format:%H' HEAD -- "$self")"
cat <<-EOH
# this file is generated via https://github.com/docker-library/hello-world/blob/$selfCommit/$self
Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon),
Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
GitRepo: https://github.com/docker-library/hello-world.git
GitCommit: $commit
EOH
# prints "$2$1$3$1...$N"
join() {
local sep="$1"; shift
local out; printf -v out "${sep//%/%%}%s" "$@"
echo "${out#$sep}"
}
arches=( *"/hello" )
arches=( "${arches[@]%"/hello"}" )
echo
cat <<-EOE
Tags: linux
SharedTags: latest
Architectures: $(join ', ' "${arches[@]}")
EOE
for arch in "${arches[@]}"; do
echo "$arch-Directory: $arch"
done
for winVariant in \
nanoserver-ltsc2025 \
nanoserver-ltsc2022 \
; do
winArches=( *"/$winVariant/hello.txt" )
winArches=( "${winArches[@]%"/$winVariant/hello.txt"}" )
if [ "${#winArches[@]}" -gt 0 ]; then
echo
cat <<-EOE
Tags: $winVariant
SharedTags: nanoserver, latest
Architectures: $(join ', ' "${winArches[@]/#/windows-}")
EOE
for arch in "${winArches[@]}"; do
echo "windows-$arch-Directory: $arch/$winVariant"
done
echo "Constraints: $winVariant"
fi
done