From 01c03167421615cbfbe6c6f626fed22ac6e0992c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 18 Feb 2020 15:51:01 +0100 Subject: (preserve_UUID_after_format) split it so that part_raw() is easier to read --- perl-install/fs/format.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'perl-install/fs') diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm index 5f841163e..039352928 100644 --- a/perl-install/fs/format.pm +++ b/perl-install/fs/format.pm @@ -280,9 +280,20 @@ sub part_raw { delete $part->{device_LABEL_changed}; - # Preserve UUID on fs where we couldn't enforce it while formatting + preserve_UUID_after_format($dev, $part, $fs_type); + after_formatting($part); +} + +=item preserve_UUID_after_format($dev, $part, $fs_type) + +Preserve UUID on fs where we couldn't enforce it while formatting + +=cut + +sub preserve_UUID_after_format { + my ($dev, $part, $fs_type) = @_; if (my $uuid_cmd = $preserve_UUID{$fs_type}) { - (undef, $cmd) = @$uuid_cmd; + my (undef, $cmd) = @$uuid_cmd; run_program::raw({}, $cmd, '-U', $part->{device_UUID}, devices::make($dev)) if $cmd; } elsif ($fs_type eq 'btrfs' && $part->{device_UUID}) { write_btrfs_uuid($part->{device_UUID}, $dev); @@ -291,8 +302,6 @@ sub part_raw { if (member($fs_type, qw(ext3 ext4))) { disable_forced_fsck($dev); } - - after_formatting($part); } sub after_formatting { -- cgit v1.2.1