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:
commit
6d85c0552c
1 changed files with 12 additions and 1 deletions
|
@ -19,8 +19,19 @@ let
|
||||||
export HOME=/root
|
export HOME=/root
|
||||||
export DISPLAY=:0.0
|
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
|
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
|
source /etc/profile
|
||||||
|
[ "$strict" = "true" ] && set -o nounset
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't use a pager when executing backdoor
|
# 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
|
# we can also run non-NixOS guests during tests. This, however, is
|
||||||
# mostly futureproofing as the test instrumentation is still very
|
# mostly futureproofing as the test instrumentation is still very
|
||||||
# tightly coupled to NixOS.
|
# 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";
|
serviceConfig.KillSignal = "SIGHUP";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue