Merge pull request #2569 from flatcar/krnowak/bail-out-on-unknown-flags

run_sdk_container: Bail out on unknown flags
This commit is contained in:
Krzesimir Nowak 2025-01-09 17:59:24 +01:00 committed by GitHub
commit 72b1dcddf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,7 +22,7 @@ mounts=()
usage() { usage() {
echo " Usage:" echo " Usage:"
echo " $0 [-t] [-v <version>] [-V <SDK version>] [-a <amd64|arm64|all>] [-n <name> ] [-x <script>] [-C <custom-container>] [--rm] [-U] [-m <src>:<dest>] [<container-command>]" echo " $0 [-t] [-v <version>] [-V <SDK version>] [-a <amd64|arm64|all>] [-n <name> ] [-x <script>] [-C <custom-container>] [--rm] [-U] [-m <src>:<dest>] [--] [<container-command>]"
echo " Start an SDK container of a given SDK release version." echo " Start an SDK container of a given SDK release version."
echo " This will create the container if it does not exist, otherwise start the existing container." echo " This will create the container if it does not exist, otherwise start the existing container."
echo " If the container is already running then it will exec into the container." echo " If the container is already running then it will exec into the container."
@ -49,6 +49,7 @@ usage() {
echo " -U Do not update the versionfile. Instead, use the version from the versionfile as-is." echo " -U Do not update the versionfile. Instead, use the version from the versionfile as-is."
echo " -m <src>:<dest> - Mount local file or directory inside the container." echo " -m <src>:<dest> - Mount local file or directory inside the container."
echo " Can be specified multiple times." echo " Can be specified multiple times."
echo " -- Stop parsing options at this point, pass the rest as the container command."
echo " -h Print this help." echo " -h Print this help."
echo echo
} }
@ -72,6 +73,8 @@ while [[ $# -gt 0 ]] ; do
update_versionfile= update_versionfile=
shift;; shift;;
-m) mounts+=( -v "$2" ); shift; shift;; -m) mounts+=( -v "$2" ); shift; shift;;
--) shift; break;;
-*) echo "Unknown flag ${1@Q}, use '-h' or '--help' for usage"; exit 1;;
*) break;; *) break;;
esac esac
done done