about summary refs log tree commit diff
path: root/nixos/modules/system/boot
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-12-30 12:53:36 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-12-30 15:07:18 +0100
commit1ba2015450263396bf47a108caba6fd66b1d5e79 (patch)
treebc8fc8ba805e8a106caf193d209af1048da9dca7 /nixos/modules/system/boot
parent468f698f609e123bb0ffae67181d07ac99eb2204 (diff)
downloadnixlib-1ba2015450263396bf47a108caba6fd66b1d5e79.tar
nixlib-1ba2015450263396bf47a108caba6fd66b1d5e79.tar.gz
nixlib-1ba2015450263396bf47a108caba6fd66b1d5e79.tar.bz2
nixlib-1ba2015450263396bf47a108caba6fd66b1d5e79.tar.lz
nixlib-1ba2015450263396bf47a108caba6fd66b1d5e79.tar.xz
nixlib-1ba2015450263396bf47a108caba6fd66b1d5e79.tar.zst
nixlib-1ba2015450263396bf47a108caba6fd66b1d5e79.zip
install-grub: Make more robust against GC'ed system profile entries
Previously this barfed with:

  updating GRUB 2 menu...
  fileparse(): need a valid pathname at /nix/store/zldbbngl0f8g5iv4rslygxwp0dbg1624-install-grub.pl line 391.
  warning: error(s) occured while switching to the new configuration
Diffstat (limited to 'nixos/modules/system/boot')
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl4
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index af39e50ff72d..b8ef02da4bc2 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -387,6 +387,10 @@ sub addProfile {
     my $curEntry = 0;
     foreach my $link (@links) {
         last if $curEntry++ >= $configurationLimit;
+        if (! -e "$link/nixos-version") {
+            warn "skipping corrupt system profile entry ‘$link’\n";
+            next;
+        }
         my $date = strftime("%F", localtime(lstat($link)->mtime));
         my $version =
             -e "$link/nixos-version"