1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00

Sync after installing the boot loader

Previously we synced just before calling switch-to-configuration.
That prevents corruption of the Nix store, but it can leave the boot
loader configuration and kernel files in /boot corrupted.  So do the
sync after installing the boot loader.
This commit is contained in:
Eelco Dolstra 2013-03-28 16:11:54 +01:00
parent 9000fd81d5
commit fbde5e027e
2 changed files with 5 additions and 4 deletions

View file

@ -191,9 +191,6 @@ fi
# If we're not just building, then make the new configuration the boot
# default and/or activate it now.
if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
# Just in case the new configuration hangs the system, do a sync now.
sync
$pathToConfig/bin/switch-to-configuration "$action"
fi

View file

@ -33,9 +33,13 @@ openlog("nixos", "", LOG_USER);
# Install or update the bootloader.
if ($action eq "switch" || $action eq "boot") {
system("@installBootLoader@ $out") == 0 or exit 1;
exit 0 if $action eq "boot";
}
# Just in case the new configuration hangs the system, do a sync now.
system("sync") unless ($ENV{"NIXOS_NO_SYNC"} // "") eq "1";
exit 0 if $action eq "boot";
# Check if we can activate the new configuration.
my $oldVersion = read_file("/run/current-system/init-interface-version", err_mode => 'quiet') // "";
my $newVersion = read_file("$out/init-interface-version");