From d472fdbef5a3dd2d27330f7ce1374e1f560332dc Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Thu, 18 Sep 2014 13:28:46 -0600 Subject: [PATCH] add usage, only build all with `--all` argument --- build.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index a48cc7a..25217a1 100755 --- a/build.sh +++ b/build.sh @@ -9,14 +9,61 @@ dir="$(dirname "$(readlink -f "$BASH_SOURCE")")" : ${LOGS:="$dir/logs"} # where "docker build" logs go : ${NAMESPACES:='library stackbrew'} # after we build, also tag each image as "NAMESPACE/repo:tag" +LIBRARY="$(readlink -f "$LIBRARY")" +SRC="$(readlink -f "$SRC")" +LOGS="$(readlink -f "$LOGS")" + # arg handling: all args are [repo|repo:tag] -# no argument means build all repos in $LIBRARY -repos=( "$@" ) -if [ ${#repos[@]} -eq 0 ]; then +usage() { + cat <&2 'error: no repos specified' + usage >&2 + exit 1 +fi + # globals for handling the repo queue and repo info parsed from library queue=() declare -A repoGitRepo=() @@ -101,6 +148,7 @@ while [ "$#" -gt 0 ]; do echo "Processing $repoTag ..." ( cd "$gitRepo" && git clean -dfxq && git checkout -q "$gitRef" && "$dir/git-set-dir-times" ) + # TODO git tag IFS=$'\n' froms=( $(grep '^FROM[[:space:]]' "$gitRepo/$gitDir/Dockerfile" | awk -F '[[:space:]]+' '{ print $2 ~ /:/ ? $2 : $2":latest" }') )