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