aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/installer/tools/nixos-enter.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/installer/tools/nixos-enter.sh')
-rw-r--r--nixpkgs/nixos/modules/installer/tools/nixos-enter.sh18
1 files changed, 9 insertions, 9 deletions
diff --git a/nixpkgs/nixos/modules/installer/tools/nixos-enter.sh b/nixpkgs/nixos/modules/installer/tools/nixos-enter.sh
index 4680cd8ae95..1fdd4627a90 100644
--- a/nixpkgs/nixos/modules/installer/tools/nixos-enter.sh
+++ b/nixpkgs/nixos/modules/installer/tools/nixos-enter.sh
@@ -60,15 +60,15 @@ chmod 0755 "$mountPoint/dev" "$mountPoint/sys"
mount --rbind /dev "$mountPoint/dev"
mount --rbind /sys "$mountPoint/sys"
-# If silent, write both stdout and stderr of activation script to /dev/null
-# otherwise, write both streams to stderr of this process
-if [ "$silent" -eq 0 ]; then
- PIPE_TARGET="/dev/stderr"
-else
- PIPE_TARGET="/dev/null"
-fi
+(
+ # If silent, write both stdout and stderr of activation script to /dev/null
+ # otherwise, write both streams to stderr of this process
+ if [ "$silent" -eq 1 ]; then
+ exec 2>/dev/null
+ fi
-# Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings.
-LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" chroot "$mountPoint" "$system/activate" >>$PIPE_TARGET 2>&1 || true
+ # Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings.
+ LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" chroot "$mountPoint" "$system/activate" 1>&2 || true
+)
exec chroot "$mountPoint" "${command[@]}"