0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixos/test-instrumentation: fix shellcheck findings with enableStrictShellChecks enabled (#349579)

This commit is contained in:
Sefa Eyeoglu 2025-01-13 10:28:43 +01:00 committed by GitHub
commit 6d85c0552c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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";
};