util/release/build-release: Use bash arrays for params

Instead of using unquoted strings for the command line parameters,
use arrays which naturally split into separate elements inside the
quotes.

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: I1c96d5072b98523af4e407cfff8f4d1d28ec3297
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67318
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
diff --git a/util/release/build-release b/util/release/build-release
index b76b155..f609bf1 100755
--- a/util/release/build-release
+++ b/util/release/build-release
@@ -40,15 +40,16 @@
 fi
 
 if [ ! -d "coreboot-${VERSION_NAME}" ]; then
+	declare -a GIT_REF_OPTS
 	if [ -d .git ]; then
-		GIT_REF_OPTS="--reference . --dissociate"
+		GIT_REF_OPTS=("--reference" "." "--dissociate")
 	elif [ -d ../../.git ]; then
-		GIT_REF_OPTS="--reference ../.. --dissociate"
+		GIT_REF_OPTS=("--reference" "../.." "--dissociate")
 	fi
 	if [ -n "${USERNAME}" ]; then
-		git clone ${GIT_REF_OPTS} "ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git" "coreboot-${VERSION_NAME}"
+		git clone "${GIT_REF_OPTS[@]}" "ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git" "coreboot-${VERSION_NAME}" --
 	else
-		git clone ${GIT_REF_OPTS} https://review.coreboot.org/coreboot.git "coreboot-${VERSION_NAME}"
+		git clone "${GIT_REF_OPTS[@]}" https://review.coreboot.org/coreboot.git "coreboot-${VERSION_NAME}" --
 	fi
 fi
 
@@ -76,13 +77,15 @@
 exclude_paths+="3rdparty/amd_blobs "
 exclude_paths+="3rdparty/qc_blobs "
 
+declare -a blobs_paths
+declare -a exclude_opts
 for i in ${exclude_paths}; do
-	blobs_paths+="coreboot-${VERSION_NAME}/${i} "
-	exclude_opts+="--exclude=coreboot-${VERSION_NAME}/${i} "
+	blobs_paths+=("coreboot-${VERSION_NAME}/${i}")
+	exclude_opts+=("--exclude=coreboot-${VERSION_NAME}/${i}")
 done
 
-tar --sort=name --mtime="$tstamp" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore ${exclude_opts} -cvf - "coreboot-${VERSION_NAME}" |xz -9 > "coreboot-${VERSION_NAME}.tar.xz"
-tar --sort=name --mtime="$tstamp" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore -cvf - ${blobs_paths} |xz -9 > "coreboot-blobs-${VERSION_NAME}.tar.xz"
+tar --sort=name --mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore "${exclude_opts[@]}" -cvf - "coreboot-${VERSION_NAME}" |xz -9 > "coreboot-${VERSION_NAME}.tar.xz"
+tar --sort=name --mtime="${tstamp}" --owner=coreboot:1000 --group=coreboot:1000 --exclude=*/.git --exclude=*/.gitignore -cvf - "${blobs_paths[@]}" |xz -9 > "coreboot-blobs-${VERSION_NAME}.tar.xz"
 
 if [ -n "${GPG_KEY_ID}" ]; then
 	gpg --armor --local-user "$GPG_KEY_ID" --output "coreboot-${VERSION_NAME}.tar.xz.sig" --detach-sig "coreboot-${VERSION_NAME}.tar.xz"