From 9a615268219f0fc6c52c5e7695f2ef6ae42c6dd0 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 23 Jun 2008 14:49:02 +0000 Subject: - bootloader-config: o fix handling xen kernels: it should not replace an existing 'linux' entry (#40865) --- perl-install/NEWS | 3 +++ perl-install/bootloader.pm | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index af7a16c39..b5d0f8ba2 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,6 @@ +- bootloader-config: + o fix handling xen kernels: it should not replace an existing 'linux' + entry (#40865) - service_harddrake: o handle nvidia173.ko (new legacy series of the proprietary driver) diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index c85a9271b..2988d3e20 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -50,6 +50,11 @@ sub vmlinuz2kernel_str { }; } +sub kernel_str2short_name { + my ($kernel) = @_; + $kernel->{ext} =~ /^xen/ ? 'xen' : $kernel->{basename}; +} + sub basename2initrd_basename { my ($basename) = @_; $basename =~ s!vmlinuz-?!!; #- here we do not use $vmlinuz_regexp since we explictly want to keep all that is not "vmlinuz" @@ -61,14 +66,14 @@ sub kernel_str2vmlinuz_long { } sub kernel_str2initrd_long { my ($kernel) = @_; - basename2initrd_basename($kernel->{basename}) . '-' . $kernel->{version} . '.img'; + basename2initrd_basename(kernel_str2short_name($kernel)) . '-' . $kernel->{version} . '.img'; } sub kernel_str2vmlinuz_short { my ($kernel) = @_; if ($kernel->{use_long_name}) { kernel_str2vmlinuz_long($kernel); } else { - $kernel->{basename}; + kernel_str2short_name($kernel); } } sub kernel_str2initrd_short { @@ -76,7 +81,7 @@ sub kernel_str2initrd_short { if ($kernel->{use_long_name}) { kernel_str2initrd_long($kernel); } else { - basename2initrd_basename($kernel->{basename}) . '.img'; + basename2initrd_basename(kernel_str2short_name($kernel)) . '.img'; } } @@ -85,8 +90,8 @@ sub kernel_str2label { if ($o_use_long_name || $kernel->{use_long_name}) { _sanitize_ver($kernel); } else { - $kernel->{basename} eq 'vmlinuz' ? ($kernel->{ext} eq 'xen' ? $kernel->{ext} : 'linux') : - $kernel->{basename}; + my $short_name = kernel_str2short_name($kernel); + $short_name eq 'vmlinuz' ? 'linux' : $short_name; } } -- cgit v1.2.1