shellcheck: fix lint of scripts in tests

This commit is contained in:
Otto Sabart 2022-08-16 21:00:00 +02:00 committed by Erik Arvstedt
parent a59c3b4b8a
commit f184bb34e6
No known key found for this signature in database
GPG key ID: 33312B944DD97846
14 changed files with 82 additions and 59 deletions

View file

@ -57,6 +57,8 @@ if [[ $EUID != 0 ]]; then
# NixOS containers require root permissions.
# By using sudo here and not at the user's call-site extra-container can detect if it is running
# inside an existing shell session (by checking an internal environment variable).
#
# shellcheck disable=SC2154
exec sudo scenario="$scenario" scriptDir="$scriptDir" NIX_PATH="$NIX_PATH" PATH="$PATH" \
scenarioOverridesFile="${scenarioOverridesFile:-}" "$scriptDir/lib/make-container.sh" "$@"
fi
@ -64,7 +66,7 @@ fi
export containerName=nb-test
containerCommand=shell
while [[ $# > 0 ]]; do
while [[ $# -gt 0 ]]; do
case $1 in
--command|-c)
shift
@ -77,14 +79,14 @@ while [[ $# > 0 ]]; do
done
containerBin=$(type -P extra-container) || true
if [[ ! ($containerBin && $(realpath $containerBin) == *extra-container-0.10*) ]]; then
if [[ ! ($containerBin && $(realpath "$containerBin") == *extra-container-0.10*) ]]; then
echo "Building extra-container. Skip this step by adding extra-container 0.10 to PATH."
nix-build --out-link /tmp/extra-container "$scriptDir"/../pkgs \
-A pinned.extra-container >/dev/null
export PATH="/tmp/extra-container/bin${PATH:+:}$PATH"
fi
read -d '' src <<EOF || true
read -rd '' src <<EOF || true
((import "$scriptDir/tests.nix" {}).getTest "$scenario").container
EOF
exec extra-container $containerCommand -E "$src" "$@"
exec extra-container "$containerCommand" -E "$src" "$@"