From c872dc4286b98f9251ad7cd30b34c3c12d611c98 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 8 Aug 2005 05:47:02 +0000 Subject: fix update_for_renumbered_partitions (bugzilla #16786) --- perl-install/bootloader.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'perl-install/bootloader.pm') diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 4f3cf87bc..3b0c3634a 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -1432,18 +1432,24 @@ sub update_for_renumbered_partitions { } %$grub2dev; } + #- NB: we make the changes with an added string inside so that hda5 is only renamed once to hda6 + foreach (@$renumbering) { my ($old, $new) = @$_; log::l("renaming $old -> $new"); - $_->{new} =~ s/\b$old/$new/g foreach @configs; + (my $lnew = $new) =~ s/(\d+)$/__DRAKX_DONE__$1/; + $_->{new} =~ s/\b$old/$lnew/g foreach @configs; any { $_->{name} eq 'grub' } @configs or next; my ($old_grub, $new_grub) = map { device_string2grub($_, [], \@sorted_hds) } $old, $new; log::l("renaming $old_grub -> $new_grub"); - $_->{new} =~ s/\Q$old_grub/$new_grub/g foreach @configs; + (my $lnew_grub = $new_grub) =~ s/\)$/__DRAKX_DONE__)/; + $_->{new} =~ s/\Q$old_grub/$lnew_grub/g foreach @configs; } + $_->{new} =~ s/__DRAKX_DONE__//g foreach @configs; + my @changed_configs = grep { $_->{orig} ne $_->{new} } @configs or return 1; # no need to update $in->ask_okcancel('', N("Your bootloader configuration must be updated because partition has been renumbered")) or return; -- cgit v1.2.1