mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/test-instrumentation: fix shellcheck findings with enableStrictShellChecks enabled
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
b792bab7c3
commit
5c30f8caf4
1 changed files with 12 additions and 1 deletions
|
@ -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";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue