summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-09-13 10:40:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-09-13 10:40:19 +0000
commit3b095707824aa4ac965e92866b919334f8b103ec (patch)
treeab5ec606f0925e6bca448cde13754994624ca87f /perl-install
parentede93e7faf703e6739cc7e743e8a937dab21987d (diff)
downloaddrakx-3b095707824aa4ac965e92866b919334f8b103ec.tar
drakx-3b095707824aa4ac965e92866b919334f8b103ec.tar.gz
drakx-3b095707824aa4ac965e92866b919334f8b103ec.tar.bz2
drakx-3b095707824aa4ac965e92866b919334f8b103ec.tar.xz
drakx-3b095707824aa4ac965e92866b919334f8b103ec.zip
- create cleanup_entries() which remove bad entries (and more verbosely than was done for lilo.conf) and call it for all bootloaders (was only for lilo)
- keep removing duplicate labels only for lilo (and use uniq_) (don't do it for grub since duplicate labels are allowed (???))
Diffstat (limited to 'perl-install')
-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) = @_;