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
# 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.
exec {logOutFd}>&1 {logErrFd}>&2
if test -w /dev/kmsg; then
exec > >(tee -i /proc/self/fd/"$logOutFd" | while read -r line; do
if test -n "$line"; then
echo "<7>stage-2-init: $line" > /dev/kmsg
fi
done) 2>&1
else
mkdir -p /run/log
exec > >(tee -i /run/log/stage-2-init.log) 2>&1
fi
# # 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.
# exec {logOutFd}>&1 {logErrFd}>&2
# if test -w /dev/kmsg; then
# exec > >(tee -i /proc/self/fd/"$logOutFd" | while read -r line; do
# if test -n "$line"; then
# echo "<7>stage-2-init: $line" > /dev/kmsg
# fi
# done) 2>&1
# else
# mkdir -p /run/log
# exec > >(tee -i /run/log/stage-2-init.log) 2>&1
# fi
fi
@ -142,8 +142,8 @@ ln -sfn "$systemConfig" /run/booted-system
# especially no need to start systemd
if [ "${IN_NIXOS_SYSTEMD_STAGE1:-}" != true ]; then
# Reset the logging file descriptors.
exec 1>&$logOutFd 2>&$logErrFd
exec {logOutFd}>&- {logErrFd}>&-
#exec 1>&$logOutFd 2>&$logErrFd
#exec {logOutFd}>&- {logErrFd}>&-
# Start systemd in a clean environment.