forked from docker-library/buildpack-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·38 lines (33 loc) · 1.09 KB
/
update.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
#!/bin/bash
set -eo pipefail
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )
debian="$(curl -fsSL 'https://raw.githubusercontent.com/docker-library/official-images/master/library/debian')"
ubuntu="$(curl -fsSL 'https://raw.githubusercontent.com/docker-library/official-images/master/library/ubuntu')"
travisEnv=
for version in "${versions[@]}"; do
if echo "$debian" | grep -qE "\b$version\b"; then
dist='debian'
elif echo "$ubuntu" | grep -qE "\b$version\b"; then
dist='ubuntu'
else
echo >&2 "error: cannot determine repo for '$version'"
exit 1
fi
for variant in curl scm ''; do
src="Dockerfile${variant:+-$variant}.template"
trg="$version${variant:+/$variant}/Dockerfile"
mkdir -p "$(dirname "$trg")"
( set -x && sed '
s!DIST!'"$dist"'!g;
s!SUITE!'"$version"'!g;
' "$src" > "$trg" )
done
travisEnv+='\n - VERSION='"$version"
done
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
echo "$travis" > .travis.yml