Add simple usage text for "update.sh" and add optional "--namespace" flag to force a namespace (especially for updating all image docs with a particular namespace applied)

This commit is contained in:
Tianon Gravi 2017-11-16 11:46:13 -08:00
parent c390af36ae
commit 47a49800cc
1 changed files with 18 additions and 0 deletions

View File

@ -4,12 +4,30 @@ set -Eeuo pipefail
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
helperDir='.template-helpers'
# usage: ./update.sh [--namespace NAMESPACE] [[NAMESPACE/]IMAGE ...]
# ie: ./update.sh
# ./update.sh debian golang
# ./update.sh --namespace tianontesting debian golang
# ./update.sh tianontesting/debian tianontestingmore/golang
# BASHBREW_ARCH=windows-amd64 BASHBREW_ARCH_NAMESPACES='...' ./update.sh --namespace winamd64
forceNamespace=
if [ "${1:-}" = '--namespace' ]; then
shift
forceNamespace="$1"
shift
fi
images=( "$@" )
if [ ${#images[@]} -eq 0 ]; then
images=( */ )
fi
images=( "${images[@]%/}" )
if [ -n "$forceNamespace" ]; then
images=( "${images[@]/#/"$forceNamespace/"}" )
fi
replace_field() {
targetFile="$1"
field="$2"