summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r--perl-install/bootloader.pm21
1 files changed, 16 insertions, 5 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 26e3d40c0..a17337d3b 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -149,6 +149,8 @@ sub read {
my $f = $bootloader::{"read_$main_method"} or die "unknown bootloader method $main_method (read)";
my $bootloader = $f->($fstab);
+ cleanup_entries($bootloader);
+
my @devs = $bootloader->{boot};
if ($bootloader->{'raid-extra-boot'} =~ /mbr/ &&
(my $md = fs::get::device2part($bootloader->{boot}, $all_hds->{raids}))) {
@@ -360,15 +362,24 @@ sub read_lilo() {
$b{method} = 'lilo-' . (member($b{install}, 'text', 'menu', 'graphic') ? $b{install} : 'graphic');
}
- #- cleanup duplicate labels & bad entries (in case file is corrupted)
- my %seen;
- @{$b{entries}} =
- grep { !$seen{$_->{label}}++ }
- grep { $_->{type} ne 'image' || -e "$::prefix$_->{kernel_or_dev}" } @{$b{entries}};
+ # cleanup duplicate labels (in case file is corrupted)
+ @{$b{entries}} = uniq_ { $_->{label} } @{$b{entries}};
\%b;
}
+sub cleanup_entries {
+ my ($bootloader) = @_;
+
+ #- cleanup bad entries (in case file is corrupted)
+ @{$bootloader->{entries}} =
+ grep {
+ my $pb = $_->{type} eq 'image' && dirname($_->{kernel_or_dev}) eq '/boot' && ! -e "$::prefix$_->{kernel_or_dev}";
+ log::l("dropping bootloader entry $_->{label} since $_->{kernel_or_dev} doesn't exist") if $pb;
+ !$pb;
+ } @{$bootloader->{entries}};
+}
+
sub suggest_onmbr {
my ($hd) = @_;