Don't redirect stage2 output

This commit is contained in:
Rodrigo Arias 2024-08-30 18:17:41 +02:00
parent 46d897a574
commit 5a97c527f4

View File

@ -91,19 +91,19 @@ if [ "${IN_NIXOS_SYSTEMD_STAGE1:-}" != true ]; then
fi fi
# Log the script output to /dev/kmsg or /run/log/stage-2-init.log. # # Log the script output to /dev/kmsg or /run/log/stage-2-init.log.
# Only at this point are all the necessary prerequisites ready for these commands. # # Only at this point are all the necessary prerequisites ready for these commands.
exec {logOutFd}>&1 {logErrFd}>&2 # exec {logOutFd}>&1 {logErrFd}>&2
if test -w /dev/kmsg; then # if test -w /dev/kmsg; then
exec > >(tee -i /proc/self/fd/"$logOutFd" | while read -r line; do # exec > >(tee -i /proc/self/fd/"$logOutFd" | while read -r line; do
if test -n "$line"; then # if test -n "$line"; then
echo "<7>stage-2-init: $line" > /dev/kmsg # echo "<7>stage-2-init: $line" > /dev/kmsg
fi # fi
done) 2>&1 # done) 2>&1
else # else
mkdir -p /run/log # mkdir -p /run/log
exec > >(tee -i /run/log/stage-2-init.log) 2>&1 # exec > >(tee -i /run/log/stage-2-init.log) 2>&1
fi # fi
fi fi
@ -142,8 +142,8 @@ ln -sfn "$systemConfig" /run/booted-system
# especially no need to start systemd # especially no need to start systemd
if [ "${IN_NIXOS_SYSTEMD_STAGE1:-}" != true ]; then if [ "${IN_NIXOS_SYSTEMD_STAGE1:-}" != true ]; then
# Reset the logging file descriptors. # Reset the logging file descriptors.
exec 1>&$logOutFd 2>&$logErrFd #exec 1>&$logOutFd 2>&$logErrFd
exec {logOutFd}>&- {logErrFd}>&- #exec {logOutFd}>&- {logErrFd}>&-
# Start systemd in a clean environment. # Start systemd in a clean environment.