Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions nixos/modules/system/boot/stage-2-init.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#! @shell@

systemConfig=@systemConfig@
verbose="@verbose@"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there still needs to be a boot.verbose flag added to stage-2.nix, similar to how it's done in stage-1.nix. Maybe it's a good idea to re-use the value of boot.initrd.verbose? I left this change out to get some feedback!


export HOME=/root PATH="@path@"

info() {
if [[ -n "$verbose" ]]; then
echo -e "$@"
fi
}

# Process the kernel command line.
for o in $(</proc/cmdline); do
Expand All @@ -21,9 +27,9 @@ done


# Print a greeting.
echo
echo -e "\e[1;32m<<< NixOS Stage 2 >>>\e[0m"
echo
info ""
info "\e[1;32m<<< NixOS Stage 2 >>>\e[0m"
info ""


# Normally, stage 1 mounts the root filesystem read/writable.
Expand Down Expand Up @@ -103,7 +109,7 @@ ln -s /run/lock /var/lock

# Clear the resume device.
if test -n "$resumeDevice"; then
mkswap "$resumeDevice" || echo 'Failed to clear saved image.'
mkswap "$resumeDevice" || info 'Failed to clear saved image.'
fi


Expand All @@ -129,7 +135,7 @@ fi

# Run the script that performs all configuration activation that does
# not have to be done at boot time.
echo "running activation script..."
info "running activation script..."
$systemConfig/activate


Expand Down Expand Up @@ -168,7 +174,7 @@ exec {logOutFd}>&- {logErrFd}>&-


# Start systemd.
echo "starting systemd..."
info "starting systemd..."

PATH=/run/current-system/systemd/lib/systemd:@fsPackagesPath@ \
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive @systemdUnitPathEnvVar@ \
Expand Down