install-grub.pl: Apply the configuration limit only to old generations

This commit is contained in:
Eelco Dolstra 2012-07-25 16:37:29 -04:00
parent db7a11b132
commit 557f39aa0f

View File

@ -125,7 +125,6 @@ $conf .= "$extraConfig\n";
# Generate the menu entries.
my $curEntry = 0;
$conf .= "\n";
my %copied;
@ -151,7 +150,6 @@ sub copyToKernelsDir {
sub addEntry {
my ($name, $path) = @_;
return if $curEntry++ > $configurationLimit;
return unless -e "$path/kernel" && -e "$path/initrd";
my $kernel = copyToKernelsDir(Cwd::abs_path("$path/kernel"));
@ -200,7 +198,9 @@ my @links = sort
{ nrFromGen($b) <=> nrFromGen($a) }
(glob "/nix/var/nix/profiles/system-*-link");
my $curEntry = 0;
foreach my $link (@links) {
last if $curEntry++ >= $configurationLimit;
my $date = strftime("%F", localtime(lstat($link)->mtime));
my $version =
-e "$link/nixos-version"