Add --shell argument

This commit is contained in:
Michael Vines 2018-09-21 09:42:50 -07:00
parent 9e3d2956d8
commit e5e325154b
1 changed files with 17 additions and 0 deletions

View File

@ -7,11 +7,18 @@ usage() {
echo a CI-appropriate environment.
echo
echo "--nopull Skip the dockerhub image update"
echo "--shell Skip command and enter an interactive shell"
echo
}
cd "$(dirname "$0")/.."
INTERACTIVE=false
if [[ $1 = --shell ]]; then
INTERACTIVE=true
shift
fi
NOPULL=false
if [[ $1 = --nopull ]]; then
NOPULL=true
@ -64,5 +71,15 @@ ARGS+=(
--env SNAPCRAFT_CREDENTIALS_KEY
)
if $INTERACTIVE; then
if [[ -n $1 ]]; then
echo
echo "Note: '$*' ignored due to --shell argument"
echo
fi
set -x
exec docker run --interactive --tty "${ARGS[@]}" "$IMAGE" bash
fi
set -x
exec docker run "${ARGS[@]}" "$IMAGE" "$@"