btrfs-progs: ci: fix docker-run argument parsing

The runner script allows to pass arguments to docker and the final
command, using the -- separator. This did not work as expected, the
arguments got concatenated to the first member, not all of them passed.
The following now works:

  $ ./docker-run --env CC=clang
  $ ./docker-run --env CC=clang --
  $ ./docker-run --env CC=clang -- /bin/bash

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-05-06 22:32:48 +02:00
parent 21a33e673d
commit b02d151bd1
1 changed files with 3 additions and 4 deletions

View File

@ -1,16 +1,15 @@
#!/bin/bash #!/bin/bash
# Run the container # Run the container
# $0 [docker arguments] [--] [command and arguments] # $0 [docker arguments] [-- command and arguments]
prefix=kdave prefix=kdave
image=$(basename `pwd` | tr '[A-Z]' '[a-z]') image=$(basename `pwd` | tr '[A-Z]' '[a-z]')
declare -a ARGS declare -a ARGS
while :; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
--) shift; break;; --) shift; break;;
--*) ARGS+="$1"; shift;; *) ARGS+=("$1"); shift;;
*) break;;
esac esac
done done