summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-02-12 23:20:42 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-02-12 23:20:42 +0000
commit8e37fcd4211fb3dc52d9ea6f805faf934a10d265 (patch)
tree94142d2b6b9c4022fcd3b41c3276c530202bdda3
parent8def074814df17875bcba85b4b6cad24e56fadae (diff)
downloaddrakx-8e37fcd4211fb3dc52d9ea6f805faf934a10d265.tar
drakx-8e37fcd4211fb3dc52d9ea6f805faf934a10d265.tar.gz
drakx-8e37fcd4211fb3dc52d9ea6f805faf934a10d265.tar.bz2
drakx-8e37fcd4211fb3dc52d9ea6f805faf934a10d265.tar.xz
drakx-8e37fcd4211fb3dc52d9ea6f805faf934a10d265.zip
in get_kernels_and_labels():
- change internal data structure - change regexp matching kernel names (was broken for 2.4.25-0.pre7.3mdk) - default to kernel 2.4 when lsb is installed
-rw-r--r--perl-install/bootloader.pm31
1 files changed, 15 insertions, 16 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index d4e5297d1..5d5356a96 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -426,36 +426,35 @@ sub get_kernels_and_labels() {
require pkgs;
@kernels =
- sort { c::rpmvercmp($b->[1], $a->[1]) || $weights{$a->[2]} <=> $weights{$b->[2]} }
- grep { -d "$::prefix/lib/modules/$_->[0]" }
+ sort { c::rpmvercmp($b->{version}, $a->{version}) || $weights{$a->{ext}} <=> $weights{$b->{ext}} }
+ grep { -d "$::prefix/lib/modules/$_->{complete_version}" }
map {
- if (my ($version, $ext) = /vmlinuz-((?:[\-.\d]*(?:mdk)?)*)(.*)/) {
- [ "$version$ext", $version, $ext ];
- } else {
- log::l("non recognised kernel name $_");
- ();
- }
+ s/vmlinuz-//;
+ { complete_version => $_, /(.*mdk)(.*)/ ? (ext => $2, version => $1) : (version => $_) };
} @kernels;
my %majors;
foreach (@kernels) {
- push @{$majors{$1}}, $_ if $_->[1] =~ /^(2\.\d+)/
+ push @{$majors{$1}}, $_ if $_->{version} =~ /^(2\.\d+)/
}
while (my ($major, $l) = each %majors) {
- $l->[0][1] = $major if @$l == 1;
+ $l->[0]{version} = $major if @$l == 1;
}
+ if (-e "$::prefix/usr/lib/lsb") {
+ my ($kernel_24, $other) = partition { $_->{ext} eq '' && $_->{version} =~ /^\Q2.4/ } @kernels;
+ @kernels = (@$kernel_24, @$other);
+ }
my %labels;
foreach (@kernels) {
- my ($complete_version, $version, $ext) = @$_;
my $label = '';
if (exists $labels{$label}) {
- $label = "-$ext";
- if (!$ext || $labels{$label}) {
- $label = "-$version$ext";
- }
+ $label = '-' . $_->{ext} if $_->{ext};
+ }
+ if (exists $labels{$label}) {
+ $label = '-' . $_->{version} . $_->{ext};
}
- $labels{$label} = $complete_version;
+ $labels{$label} = $_->{complete_version};
}
%labels;
}