diff options
Diffstat (limited to 'perl-install/fs')
-rw-r--r-- | perl-install/fs/format.pm | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm index 23f37502a..5f841163e 100644 --- a/perl-install/fs/format.pm +++ b/perl-install/fs/format.pm @@ -213,6 +213,22 @@ sub write_btrfs_uuid { die "failed to set UUID to '$UUID' on $dev (status=$status)" if !$status; } +=item sub option_to_preserve_UUID_while_formating($part, $fs_type) + +Return the options needed to preserve UUID while formating + +=cut + +sub option_to_preserve_UUID_while_formating { + my ($part, $fs_type) = @_; + if (member($fs_type, qw(swap ext2 ext3 ext4))) { + return '-U', $part->{device_UUID} if $part->{device_UUID}; + } elsif ($fs_type eq 'reiserfs') { + return '-u', $part->{device_UUID} if $part->{device_UUID}; + } + return (); +} + =item part_raw($part, $wait_message) Actually format the $part partition disk. $wait_message is only used when formating ext3/4. @@ -246,13 +262,8 @@ sub part_raw { push @options, '-l', 'bootstrap'; } - # Preserve UUID - if (member($fs_type, qw(swap ext2 ext3 ext4))) { - push @options, '-U', $part->{device_UUID} if $part->{device_UUID}; - } elsif ($fs_type eq 'reiserfs') { - push @options, '-u', $part->{device_UUID} if $part->{device_UUID}; - } - + push @options, option_to_preserve_UUID_while_formating($part, $fs_type); + if ($part->{device_LABEL}) { push @options, @{$LABELs{$fs_type}}[0], $part->{device_LABEL}; } |