summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2020-02-18 15:44:22 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2020-03-18 15:45:14 +0100
commit2e7098e56cb38236c47126e4372d0aa0ceed0dfe (patch)
treea5865c207be7fd929e018e31752da90f813cc576
parent792e0bae67da7aa7f6556eaa72fc03e72e073d51 (diff)
downloaddrakx-2e7098e56cb38236c47126e4372d0aa0ceed0dfe.tar
drakx-2e7098e56cb38236c47126e4372d0aa0ceed0dfe.tar.gz
drakx-2e7098e56cb38236c47126e4372d0aa0ceed0dfe.tar.bz2
drakx-2e7098e56cb38236c47126e4372d0aa0ceed0dfe.tar.xz
drakx-2e7098e56cb38236c47126e4372d0aa0ceed0dfe.zip
(option_to_preserve_UUID_while_formating) split it
-rw-r--r--perl-install/fs/format.pm25
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};
}