Fix shellcheck complaints about provisioning scripts

Also adds executable attributes to shell scripts that were missing it.

Change-Id: Id52ef495147fdbfb5cb1a1f711fac530e0e85f3b
Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Tony Sarajärvi
2023-03-29 12:04:54 +00:00
parent ddef5cc5f2
commit 620666bce4
263 changed files with 457 additions and 422 deletions

View File

@@ -14,7 +14,7 @@
set -e
[ x"$1" = x ] && echo "$0 takes a path as a first argument" && exit 1
[ -z "$1" ] && echo "$0 takes a path as a first argument" && exit 1
# Try to run in high priority to avoid slow-downs because of
# factors other than I/O.
@@ -25,4 +25,4 @@ rlatency="$(ioping -B -k -c 3 -i 0.1 "$1" | cut -d " " -f 5)"
wlatency="$(ioping -B -k -c 3 -i 0.1 -W "$1" | cut -d " " -f 5)"
printf "ioping,path=$1 read_latency_ns=%u,write_latency_ns=%u\n" \
$rlatency $wlatency
"$rlatency" "$wlatency"

View File

@@ -4,11 +4,11 @@
set -e
PROVISIONING_DIR="$(dirname "$0")/../../../"
. "$PROVISIONING_DIR"/common/unix/common.sourced.sh
. "$PROVISIONING_DIR"/common/unix/DownloadURL.sh
# shellcheck source=../../../common/unix/common.sourced.sh
source "$PROVISIONING_DIR"/common/unix/common.sourced.sh
# shellcheck source=../../../common/unix/DownloadURL.sh
source "$PROVISIONING_DIR"/common/unix/DownloadURL.sh
# Sort files by their SHA-1, and then return the accumulated result
sha1tree () {
@@ -16,14 +16,14 @@ sha1tree () {
[ -x "$(command -v sha1sum)" ] || SHASUM=shasum
find "$@" -type f -print0 | \
xargs -0 ${SHASUM-sha1sum} | cut -d ' ' -f 1 | \
sort | ${SHASUM-sha1sum} | cut -d ' ' -f 1
xargs -0 "${SHASUM-sha1sum}" | cut -d ' ' -f 1 | \
sort | "${SHASUM-sha1sum}" | cut -d ' ' -f 1
}
SERVER_PATH="$PROVISIONING_DIR/common/shared/testserver"
. "$SERVER_PATH/settings.sh"
source "$SERVER_PATH/settings.sh"
# Download all necessary dependencies outside of the dockerfiles, so that we
@@ -87,10 +87,10 @@ do
# backwards-incompatible changes across repositories.
context="$SERVER_PATH/$server"
tag=$(sha1tree $context)
docker build -t qt-test-server-$server:latest \
-t qt-test-server-$server:$tag \
$context
tag=$(sha1tree "$context")
docker build -t "qt-test-server-$server:latest" \
-t "qt-test-server-$server:$tag" \
"$context"
done
docker images

View File

@@ -7,16 +7,16 @@ set -ex
TestMachine='qt-test-server'
# Deploy docker virtual machine (Boot2Docker) into VirtualBox only if it doesn't exist
if [ -z $(docker-machine ls -q --filter "name=$TestMachine") ]
if [ -z "$(docker-machine ls -q --filter "name=$TestMachine")" ]
then
docker-machine create $@ $TestMachine
docker-machine ip $TestMachine
docker-machine create "$@" "$TestMachine"
docker-machine ip "$TestMachine"
else
# Otherwise, start the docker machine and update with new TLS certificates.
docker-machine start $TestMachine && docker-machine regenerate-certs -f $TestMachine
docker-machine start "$TestMachine" && docker-machine regenerate-certs -f "$TestMachine"
fi
# Switch the docker engine to $TestMachine
eval $(docker-machine env $TestMachine)
eval "$(docker-machine env "$TestMachine")"
docker-machine ls

View File

@@ -4,7 +4,7 @@
set -ex
[ -x "$(command -v realpath)" ] && FILE=$(realpath ${BASH_SOURCE[0]}) || FILE=${BASH_SOURCE[0]}
[ -x "$(command -v realpath)" ] && FILE=$(realpath "${BASH_SOURCE[0]}") || FILE="${BASH_SOURCE[0]}"
case $FILE in
*/*) SERVER_PATH="${FILE%/*}" ;;
*) SERVER_PATH="." ;;
@@ -23,4 +23,4 @@ esac
docker info
# Create images
$SERVER_PATH/docker_images.sh
"$SERVER_PATH/docker_images.sh"

1
coin/provisioning/common/shared/testserver/settings.sh Normal file → Executable file
View File

@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# Copyright (C) 2019 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only