Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
Simplify repo logic by allowing "repo" to include a slash
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Aug 8, 2014
1 parent a66122a commit 1e71999
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ if [ ${#versions[@]} -eq 0 ]; then
fi
versions=( "${versions[@]%/}" )

user="$(docker info | awk '/^Username:/ { print $2 }')"
[ -z "$user" ] || user="$user/"

get_part() {
dir="$1"
shift
Expand All @@ -33,6 +30,14 @@ get_part() {
}

repo="$(get_part . repo '')"
if [ "$repo" ]; then
if [[ "$repo" != */* ]]; then
user="$(docker info | awk '/^Username:/ { print $2 }')"
if [ "$user" ]; then
repo="$user/$repo"
fi
fi
fi

for version in "${versions[@]}"; do
dir="$(readlink -f "$version")"
Expand Down Expand Up @@ -61,11 +66,11 @@ for version in "${versions[@]}"; do
sudo chown -R "$(id -u):$(id -g)" "$dir"

if [ "$repo" ]; then
docker build -t "${user}${repo}:${suite}" "$dir"
docker build -t "${repo}:${suite}" "$dir"
if [ "$suite" != "$version" ]; then
docker tag "${user}${repo}:${suite}" "${user}${repo}:${version}"
docker tag "${repo}:${suite}" "${repo}:${version}"
fi
docker run -it --rm "${user}${repo}:${suite}" bash -xc '
docker run -it --rm "${repo}:${suite}" bash -xc '
cat /etc/apt/sources.list
echo
cat /etc/os-release 2>/dev/null
Expand All @@ -80,5 +85,5 @@ done

latest="$(get_part . latest '')"
if [ "$latest" ]; then
docker tag "${user}${repo}:${latest}" "${user}${repo}:latest"
docker tag "${repo}:${latest}" "${repo}:latest"
fi

0 comments on commit 1e71999

Please sign in to comment.