run-builder: argument checking

Check we have at least one positional argument, and it is either
"start", "stop" or "fg".
This commit is contained in:
Christian Kellner 2020-09-10 18:50:45 +02:00 committed by Tom Gundersen
parent 928d2278be
commit dd2d3cf0a9

View file

@ -37,6 +37,18 @@ builder_stop() {
${CONTAINER_RUNTIME} stop org.osbuild.koji.builder || true
}
# check arguments
if [[ $# -ne 1 || ( "$1" != "start" && "$1" != "stop" && "$1" != "fg") ]]; then
cat <<DOC
usage: $0 start|stop|fg
start - starts the builder container (background)
fg - start the builder container in the foreground
stop - stops and removes the builder container
DOC
exit 3
fi
# default to running in the background
CONTAINER_FLAGS=-d