@@ -252,7 +252,7 @@ if ($grubVersion == 1) {
252252 timeout $timeout
253253 ";
254254 if ($splashImage) {
255− copy $splashImage, "$bootPath/background.xpm.gz" or die "cannot copy $splashImage to $bootPath\n";
255+ copy $splashImage, "$bootPath/background.xpm.gz" or die "cannot copy $splashImage to $bootPath: $!\n";
256256 $conf .= "splashimage " . ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/background.xpm.gz\n";
257257 }
258258}
@@ -330,7 +330,7 @@ else {
330330 ";
331331
332332 if ($font) {
333− copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath\n";
333+ copy $font, "$bootPath/converted-font.pf2" or die "cannot copy $font to $bootPath: $!\n";
334334 $conf .= "
335335 insmod font
336336 if loadfont " . ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/converted-font.pf2; then
@@ -358,7 +358,7 @@ else {
358358 background_color '$backgroundColor'
359359 ";
360360 }
361− copy $splashImage, "$bootPath/background$suffix" or die "cannot copy $splashImage to $bootPath\n";
361+ copy $splashImage, "$bootPath/background$suffix" or die "cannot copy $splashImage to $bootPath: $!\n";
362362 $conf .= "
363363 insmod " . substr($suffix, 1) . "
364364 if background_image --mode '$splashMode' " . ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/background$suffix; then
@@ -392,8 +392,8 @@ sub copyToKernelsDir {
392392 # kernels or initrd if this script is ever interrupted.
393393 if (! -e $dst) {
394394 my $tmp = "$dst.tmp";
395− copy $path, $tmp or die "cannot copy $path to $tmp\n";
396− rename $tmp, $dst or die "cannot rename $tmp to $dst\n";
395+ copy $path, $tmp or die "cannot copy $path to $tmp: $!\n";
396+ rename $tmp, $dst or die "cannot rename $tmp to $dst: $!\n";
397397 }
398398 $copied{$dst} = 1;
399399 return ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/kernels/$name";
@@ -416,10 +416,10 @@ sub addEntry {
416416 # Make sure initrd is not world readable (won't work if /boot is FAT)
417417 umask 0137;
418418 my $initrdSecretsPathTemp = File::Temp::mktemp("$initrdSecretsPath.XXXXXXXX");
419− system("$path/append-initrd-secrets", $initrdSecretsPathTemp) == 0 or die "failed to create initrd secrets\n";
419+ system("$path/append-initrd-secrets", $initrdSecretsPathTemp) == 0 or die "failed to create initrd secrets: $!\n";
420420 # Check whether any secrets were actually added
421421 if (-e $initrdSecretsPathTemp && ! -z _) {
422− rename $initrdSecretsPathTemp, $initrdSecretsPath or die "failed to move initrd secrets into place\n";
422+ rename $initrdSecretsPathTemp, $initrdSecretsPath or die "failed to move initrd secrets into place: $!\n";
423423 $copied{$initrdSecretsPath} = 1;
424424 $initrd .= " " . ($grubBoot->path eq "/" ? "" : $grubBoot->path) . "/kernels/$initrdName-secrets";
425425 } else {
@@ -586,7 +586,7 @@ if (get("useOSProber") eq "true") {
586586}
587587
588588# Atomically switch to the new config
589−rename $tmpFile, $confFile or die "cannot rename $tmpFile to $confFile\n";
589+rename $tmpFile, $confFile or die "cannot rename $tmpFile to $confFile: $!\n";
590590
591591
592592# Remove obsolete files from $bootPath/kernels.
@@ -664,8 +664,8 @@ if (($ENV{'NIXOS_INSTALL_GRUB'} // "") eq "1") {
664664my $requireNewInstall = $devicesDiffer || $extraGrubInstallArgsDiffer || $nameDiffer || $versionDiffer || $efiDiffer || $efiMountPointDiffer || (($ENV{'NIXOS_INSTALL_BOOTLOADER'} // "") eq "1");
665665
666666# install a symlink so that grub can detect the boot drive
667−my $tmpDir = File::Temp::tempdir(CLEANUP => 1) or die "Failed to create temporary space";
668−symlink "$bootPath", "$tmpDir/boot" or die "Failed to symlink $tmpDir/boot";
667+my $tmpDir = File::Temp::tempdir(CLEANUP => 1) or die "Failed to create temporary space: $!";
668+symlink "$bootPath", "$tmpDir/boot" or die "Failed to symlink $tmpDir/boot: $!";
669669
670670# install non-EFI GRUB
671671if (($requireNewInstall != 0) && ($efiTarget eq "no" || $efiTarget eq "both")) {
@@ -679,7 +679,7 @@ if (($requireNewInstall != 0) && ($efiTarget eq "no" || $efiTarget eq "both")) {
679679 if ($grubTarget ne "") {
680680 push @command, "--target=$grubTarget";
681681 }
682− (system @command) == 0 or die "$0: installation of GRUB on $dev failed\n";
682+ (system @command) == 0 or die "$0: installation of GRUB on $dev failed: $!\n";
683683 }
684684}
685685
@@ -698,7 +698,7 @@ if (($requireNewInstall != 0) && ($efiTarget eq "only" || $efiTarget eq "both"))
698698 push @command, "--removable" if $efiInstallAsRemovable eq "true";
699699 }
700700
701− (system @command) == 0 or die "$0: installation of GRUB EFI into $efiSysMountPoint failed\n";
701+ (system @command) == 0 or die "$0: installation of GRUB EFI into $efiSysMountPoint failed: $!\n";
702702}
703703
704704
@@ -722,5 +722,5 @@ if ($requireNewInstall != 0) {
722722 close FILE or die;
723723
724724 # Atomically switch to the new state file
725− rename $stateFileTmp, $stateFile or die "cannot rename $stateFileTmp to $stateFile\n";
725+ rename $stateFileTmp, $stateFile or die "cannot rename $stateFileTmp to $stateFile: $!\n";
726726}