summaryrefslogtreecommitdiffstats
path: root/perl-install/fs/format.pm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-06-24 13:00:14 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-06-24 13:25:36 +0200
commit3d24a1eb51fd57b0025d997002202cf6b3ce5678 (patch)
tree5d8fd96f5be27ca34850b7b9179b5297f0a83ad6 /perl-install/fs/format.pm
parent484587813638808c1dace9483a22fc242e0d8625 (diff)
downloaddrakx-3d24a1eb51fd57b0025d997002202cf6b3ce5678.tar
drakx-3d24a1eb51fd57b0025d997002202cf6b3ce5678.tar.gz
drakx-3d24a1eb51fd57b0025d997002202cf6b3ce5678.tar.bz2
drakx-3d24a1eb51fd57b0025d997002202cf6b3ce5678.tar.xz
drakx-3d24a1eb51fd57b0025d997002202cf6b3ce5678.zip
keep UUID when formating btrfs (mga#18673)
Diffstat (limited to 'perl-install/fs/format.pm')
-rw-r--r--perl-install/fs/format.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm
index bab6ad83d..0be25e3d7 100644
--- a/perl-install/fs/format.pm
+++ b/perl-install/fs/format.pm
@@ -65,7 +65,6 @@ my %edit_LABEL = ( # package, command, option
# Preserve UUID on fs where we couldn't enforce it while formatting
my %preserve_UUID = ( # package, command
- #btrfs => [ 'btrfs-progs', 'btrfstune' ], # btrfstune needs answering 'y'
jfs => [ 'jfsutils', 'jfs_tune', ],
xfs => [ 'xfsprogs', 'xfs_admin' ],
nilfs2 => [ 'nilfs-utils', 'nilfs-tune' ],
@@ -144,6 +143,13 @@ sub write_label {
delete $part->{device_LABEL_changed};
}
+sub write_btrfs_uuid {
+ my ($UUID, $dev) = @_;
+ $dev = devices::make($dev);
+ my $status = system("echo y|btrfstune -U $UUID $dev") == 0;
+ die "failed to set UUID to '$UUID' on $dev (status=$status)" if !$status;
+}
+
sub part_raw {
my ($part, $wait_message) = @_;
@@ -197,6 +203,8 @@ sub part_raw {
if (my $uuid_cmd = $preserve_UUID{$fs_type}) {
(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);
}
if (member($fs_type, qw(ext3 ext4))) {