summaryrefslogtreecommitdiff
path: root/start-container-qemu.sh
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2020-04-22 15:24:49 +0100
committerDavid Spickett <david.spickett@linaro.org>2020-04-23 12:54:33 +0100
commit52eb5a521c093601e3fba856599288bad7a5d96f (patch)
tree0e8a0c567c9d727becf411078f44cfc619c5f954 /start-container-qemu.sh
parent2382c087b5f0d51a4556c8c62f4723ab5a0ab7c9 (diff)
Shellcheck fixes round 2
Also update the sanity check script to include .job files. Change-Id: Ibf72d9ff346ff7b012d4e282a6ac8f3b7e73590d
Diffstat (limited to 'start-container-qemu.sh')
-rwxr-xr-xstart-container-qemu.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/start-container-qemu.sh b/start-container-qemu.sh
index a4f26886..94cbecb6 100755
--- a/start-container-qemu.sh
+++ b/start-container-qemu.sh
@@ -37,14 +37,18 @@ container=$(mktemp)
# Run container as privileged to mount host's /dev inside container to gain
# access to /dev/kvm.
# Publish container's port 2222, which is forwarded to VM's ssh server.
-$(dirname "$0")/start-container-docker.sh "${docker_args[@]}" --docker_opts "--privileged --publish 2222" > "$container"
+"$(dirname "$0")"/start-container-docker.sh "${docker_args[@]}" --docker_opts "--privileged --publish 2222" > "$container"
+# shellcheck disable=SC2064
trap "rm $container; cleanup_all_containers" EXIT
. "$container"
+declare host
eval "host=\$${prefix}container_host"
+declare port
eval "port=\$${prefix}container_port"
+declare container_id
eval "container_id=\$${prefix}container_id"
container_exec ()
{
@@ -56,7 +60,7 @@ nfsroot="/tmp/nfsroot"
container_exec sudo mkdir "$nfsroot"
container_exec sudo rsync -a --one-file-system / $nfsroot/
-nfsip=$(ssh $host docker inspect --format {{.NetworkSettings.IPAddress}} "$container_id")
+nfsip=$(ssh $host docker inspect --format "{{.NetworkSettings.IPAddress}}" "$container_id")
# Start NFS server inside container.
# Note, for NFS server to work inside container kernel should have
@@ -97,9 +101,9 @@ memory=$(print_memory_limit "$task" "$weight" "$ncpus")
memory=$(($memory*2/3))
wget_wildcard_url "$kernel_url"
-rsync -e "ssh -p$port" -az "$(ls $(basename "$kernel_url"))" "$host:/tmp/kernel"
+rsync -e "ssh -p$port" -az "$(ls "$(basename "$kernel_url")")" "$host:/tmp/kernel"
wget_wildcard_url "$initrd_url"
-rsync -e "ssh -p$port" -az "$(ls $(basename "$initrd_url"))" "$host:/tmp/initrd"
+rsync -e "ssh -p$port" -az "$(ls "$(basename "$initrd_url")")" "$host:/tmp/initrd"
# "-f" is to start qemu in the background.
# "-Snone" is to avoid mixing this session with any other shared sessions.