summaryrefslogtreecommitdiffstats
path: root/perl-install/bootloader.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-08-16 17:31:36 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-08-16 17:31:36 +0000
commitf8c5002658cd61df336e6862376dea73d5c852eb (patch)
tree54d5b11030427438c07f1f8ee6cfe0a6242428f8 /perl-install/bootloader.pm
parent2db552576786ffc38ed81b2ddde3d6e761207140 (diff)
downloaddrakx-backup-do-not-use-f8c5002658cd61df336e6862376dea73d5c852eb.tar
drakx-backup-do-not-use-f8c5002658cd61df336e6862376dea73d5c852eb.tar.gz
drakx-backup-do-not-use-f8c5002658cd61df336e6862376dea73d5c852eb.tar.bz2
drakx-backup-do-not-use-f8c5002658cd61df336e6862376dea73d5c852eb.tar.xz
drakx-backup-do-not-use-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.pm19
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';
}