nixos/test-instrumentation: fix shellcheck findings with enableStrictShellChecks enabled

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2024-10-18 18:57:51 +02:00
parent b792bab7c3
commit 5c30f8caf4
No known key found for this signature in database
GPG key ID: E13DFD4B47127951

View file

@ -19,8 +19,19 @@ let
export HOME=/root
export DISPLAY=:0.0
# Determine if this script is ran with nounset
strict="false"
if set -o | grep --quiet --perl-regexp "nounset\s+on"; then
strict="true"
fi
if [[ -e /etc/profile ]]; then
# TODO: Currently shell profiles are not checked at build time,
# so we need to unset stricter options to source them
set +o nounset
# shellcheck disable=SC1091
source /etc/profile
[ "$strict" = "true" ] && set -o nounset
fi
# Don't use a pager when executing backdoor
@ -45,7 +56,7 @@ let
# we can also run non-NixOS guests during tests. This, however, is
# mostly futureproofing as the test instrumentation is still very
# tightly coupled to NixOS.
PS1= exec ${pkgs.coreutils}/bin/env bash --norc /dev/hvc0
PS1="" exec ${pkgs.coreutils}/bin/env bash --norc /dev/hvc0
'';
serviceConfig.KillSignal = "SIGHUP";
};