diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-08-16 17:31:36 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-08-16 17:31:36 +0000 |
commit | f8c5002658cd61df336e6862376dea73d5c852eb (patch) | |
tree | 54d5b11030427438c07f1f8ee6cfe0a6242428f8 /perl-install/bootloader.pm | |
parent | 2db552576786ffc38ed81b2ddde3d6e761207140 (diff) | |
download | drakx-f8c5002658cd61df336e6862376dea73d5c852eb.tar drakx-f8c5002658cd61df336e6862376dea73d5c852eb.tar.gz drakx-f8c5002658cd61df336e6862376dea73d5c852eb.tar.bz2 drakx-f8c5002658cd61df336e6862376dea73d5c852eb.tar.xz drakx-f8c5002658cd61df336e6862376dea73d5c852eb.zip |
(add_entry): new entry will now keep its label, the conflicting one will be renamed "old_xxx" (and not the opposite)
Diffstat (limited to 'perl-install/bootloader.pm')
-rw-r--r-- | perl-install/bootloader.pm | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 274abe8ef..57524dd1c 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -148,19 +148,22 @@ sub same_entries { sub add_entry { my ($bootloader, $v) = @_; + my $to_add = $v; foreach my $label ($v->{label}, map { 'old' . $_ . '_' . $v->{label} } ('', 2..10)) { my $conflicting = get_label($label, $bootloader); - if ($conflicting && same_entries($conflicting, $v)) { - #- removing $conflicting. - #- It's better than better $conflicting and not adding $v because same_entries can match not so same entries, esp. regarding symlinks - @{$bootloader->{entries}} = grep { $_ != $conflicting } @{$bootloader->{entries}}; - undef $conflicting; + + if ($conflicting) { + #- replacing $conflicting with $to_add + $to_add->{label} = $label; + @{$bootloader->{entries}} = map { $_ == $conflicting ? $to_add : $_ } @{$bootloader->{entries}}; } - if (!$conflicting) { - $v->{label} = $label; - push @{$bootloader->{entries}}, $v; + if (!$conflicting || same_entries($conflicting, $to_add)) { + #- we have found an unused label + $to_add->{label} = $label; + push @{$bootloader->{entries}}, $to_add; return $v; } + $to_add = $conflicting; } die 'add_entry'; } |