about summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-2-init.sh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-23 11:53:37 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-23 11:56:09 +0100
commitdeae4eff7b837a51699a10e499c3dc7311fd3ef1 (patch)
treec5f60700f6bf65fc484d8617d630a2d8e31ba1eb /nixos/modules/system/boot/stage-2-init.sh
parent6f6e2c430fbe51ccb6b803134236af0d9aa85e55 (diff)
Make stage-1/2 logging unconditional, and drop log level to "debug"
Using "debug" level prevents spamming the console with messages twice
(once directly and once via kmsg).
Diffstat (limited to 'nixos/modules/system/boot/stage-2-init.sh')
-rw-r--r--nixos/modules/system/boot/stage-2-init.sh30
1 files changed, 13 insertions, 17 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index 17b24e1678bef..9b34d24bdbc5d 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -157,18 +157,16 @@ mount -t tmpfs -o "mode=0755" tmpfs /var/setuid-wrappers
 
 # Optionally 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.
-if test -n "@logCommands@"; then
-    exec {logOutFd}>&1 {logErrFd}>&2
-    if test -w /dev/kmsg; then
-        exec > >(tee -i /proc/self/fd/"$logOutFd" | while read line; do
-            if test -n "$line"; then
-                echo "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
+exec {logOutFd}>&1 {logErrFd}>&2
+if test -w /dev/kmsg; then
+    exec > >(tee -i /proc/self/fd/"$logOutFd" | while read 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
 
 
@@ -199,11 +197,9 @@ ln -sfn /run/booted-system /nix/var/nix/gcroots/booted-system
 @shell@ @postBootCommands@
 
 
-# Reset the logging file descriptors
-if test -n "@logCommands@"; then
-    exec 1>&$logOutFd 2>&$logErrFd
-    exec {logOutFd}>&- {logErrFd}>&-
-fi 
+# Reset the logging file descriptors.
+exec 1>&$logOutFd 2>&$logErrFd
+exec {logOutFd}>&- {logErrFd}>&-
 
 
 # Start systemd.