forked from docker-library/buildpack-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·33 lines (29 loc) · 908 Bytes
/
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
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )
debian="$(curl -fsSL 'https://github.com/docker-library/official-images/blob/master/library/debian')"
ubuntu="$(curl -fsSL 'https://github.com/docker-library/official-images/blob/master/library/ubuntu-debootstrap')"
for version in "${versions[@]}"; do
if echo "$debian" | grep -q "$version:"; then
dist='debian'
elif echo "$ubuntu" | grep -q "$version:"; then
dist='ubuntu-debootstrap'
else
echo >&2 "error: cannot determine repo for '$version'"
exit 1
fi
for variant in curl scm ''; do
src="Dockerfile.template${variant:+-$variant}"
trg="$version${variant:+/$variant}/Dockerfile"
mkdir -p "$(dirname "$trg")"
( set -x && sed '
s!DIST!'"$dist"'!g;
s!SUITE!'"$version"'!g;
' "$src" > "$trg" )
done
done