summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-06-25 07:03:58 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-06-25 07:03:58 +0000
commite4032517c581164bacfbe47ce82386456a2133cb (patch)
treec83a9a85406d74652e0aa1ab957a82f0df99e97e
parent538f23f08ac464d4eeb9f427b7b0c461088c7e5c (diff)
downloaddrakx-e4032517c581164bacfbe47ce82386456a2133cb.tar
drakx-e4032517c581164bacfbe47ce82386456a2133cb.tar.gz
drakx-e4032517c581164bacfbe47ce82386456a2133cb.tar.bz2
drakx-e4032517c581164bacfbe47ce82386456a2133cb.tar.xz
drakx-e4032517c581164bacfbe47ce82386456a2133cb.zip
when adding a new kernel, have a nicer new name for conflicting entry
-rw-r--r--perl-install/bootloader.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 180edf28f..2b076a969 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -84,8 +84,9 @@ sub vmlinuz2kernel_str {
};
}
sub kernel_str2label {
- my ($kernel) = @_;
- $kernel->{use_long_name} ? sanitize_ver("linux-$kernel->{version}") :
+ my ($kernel, $o_use_long_name) = @_;
+ $o_use_long_name || $kernel->{use_long_name} ?
+ sanitize_ver("linux-$kernel->{version}") :
$kernel->{ext} ? "linux$kernel->{ext}" : 'linux';
}
@@ -310,7 +311,8 @@ sub add_entry {
my ($bootloader, $v) = @_;
my $to_add = $v;
- foreach my $label ($v->{label}, map { 'old' . $_ . '_' . $v->{label} } ('', 2..10)) {
+ my $label = $v->{label};
+ for (my $i = 0; $i < 10;) {
my $conflicting = get_label($label, $bootloader);
$to_add->{label} = $label;
@@ -328,6 +330,9 @@ sub add_entry {
return $v;
}
$to_add = $conflicting;
+
+ my $new_label = $v->{label} eq 'linux' && kernel_str2label(vmlinuz2kernel_str($to_add->{kernel_or_dev}), 'use_long_name');
+ $label = $new_label && $label ne $new_label ? $new_label : 'old' . ($i++ ? $i : '') . "_$label";
}
die 'add_entry';
}