Update variant.sh with a bit more flexibility (so we can have "variant override" files per-image)
This commit is contained in:
parent
112dd86402
commit
7b731dc9b2
|
|
@ -9,6 +9,7 @@ if [ -z "$repo" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||||
|
repoDir="$dir/../$repo"
|
||||||
url='https://raw.githubusercontent.com/docker-library/official-images/master/library/'"$repo"
|
url='https://raw.githubusercontent.com/docker-library/official-images/master/library/'"$repo"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
|
|
@ -17,12 +18,15 @@ unset IFS
|
||||||
|
|
||||||
text=
|
text=
|
||||||
for tag in "${tags[@]}"; do
|
for tag in "${tags[@]}"; do
|
||||||
if [ -f "$dir/variant-${tag}.md" ]; then
|
for f in "$repoDir/variant-$tag.md" "$dir/variant-$tag.md"; do
|
||||||
|
if [ -f "$f" ]; then
|
||||||
text+=$'\n' # give a little space
|
text+=$'\n' # give a little space
|
||||||
# because parameter expansion eats the trailing newline
|
# because parameter expansion eats the trailing newline
|
||||||
text+="$(<"$dir/variant-${tag}.md")"$'\n'
|
text+="$(<"$f")"$'\n'
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
done
|
||||||
if [ "$text" ]; then
|
if [ "$text" ]; then
|
||||||
latest=($(curl -fsSL "$url" | grep "latest.*github.com" | sed -e 's!git://github.com/!!' -e 's/@/ /' -))
|
latest=($(curl -fsSL "$url" | grep "latest.*github.com" | sed -e 's!git://github.com/!!' -e 's/@/ /' -))
|
||||||
if [ -z "latest" ]; then
|
if [ -z "latest" ]; then
|
||||||
|
|
@ -34,9 +38,10 @@ if [ "$text" ]; then
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
if [ "$baseImage" = "buildpack-deps" ]; then
|
if [ "$baseImage" = "buildpack-deps" ]; then
|
||||||
cat "$dir/variant-buildpacks.md"
|
f='variant-buildpacks.md'
|
||||||
else
|
else
|
||||||
cat "$dir/variant.md"
|
f='variant.md'
|
||||||
fi
|
fi
|
||||||
|
[ -f "$repoDir/$f" ] && cat "$repoDir/$f" || cat "$dir/$f"
|
||||||
echo "$text"
|
echo "$text"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue