From 348c5f4eb2015dd237187cdb8fe71a98c16cf128 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 22 Jan 2009 10:37:15 +0000 Subject: don't rewrite label when it did not change (#47186) --- perl-install/NEWS | 3 +++ perl-install/diskdrake/interactive.pm | 5 ++++- perl-install/fs/format.pm | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index f1c65c6b1..af7896b3e 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,6 @@ +- diskdrake: + o don't rewrite label when it did not change (#47186) + Version 11.80 - 21 January 2008 - diskdrake: diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index caf8547bc..eaf2c8db4 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -41,6 +41,7 @@ struct part { bool prefer_device_UUID # should the {device_UUID} or the {device} be used in fstab bool prefer_device # should the {device} be used in fstab bool faked_device # false if {device} is a real device, true for nfs/smb/dav/none devices. If the field does not exist, we do not know + bool device_LABEL_changed # true if device_LABEL is different from the one on the disk string rootDevice # 'sda', 'hdc' ... (can also be a VG_name) string real_mntpoint # directly on real /, '/tmp/hdimage' ... @@ -603,7 +604,7 @@ sub Type { sub Label { my ($in, $_hd, $part) = @_; - my $old_label = $part->{device_LABEL}; + my $old_label = $part->{device_LABEL} || ""; $in->ask_from(N("Set volume label"), N("Beware, this will be written to disk as soon as you validate!"), [ @@ -614,6 +615,8 @@ sub Label { $part->{device_LABEL} = $old_label; return; } + return if $old_label eq $part->{device_LABEL}; + $part->{device_LABEL_changed} = 1; $part->{prefer_device_LABEL} = to_bool($part->{device_LABEL}) && !isLVM($part); fs::format::clean_label($part); fs::format::write_label($part); diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm index d621b6067..4a2b31405 100644 --- a/perl-install/fs/format.pm +++ b/perl-install/fs/format.pm @@ -108,7 +108,7 @@ sub part { sub write_label { my ($part) = @_; - $part->{device_LABEL} or return; + $part->{device_LABEL_changed} or return; $part->{isNotFormatted} and return; if ($part->{encrypt_key}) { @@ -124,6 +124,7 @@ sub write_label { @args = ($cmd, devices::make($dev), $part->{device_LABEL}); } run_program::raw({ timeout => 'never' }, @args) or die N("setting label on %s failed", $dev); + delete $part->{device_LABEL_changed}; } sub part_raw { @@ -222,6 +223,7 @@ sub clean_label { log::l("dropping LABEL=$part->{device_LABEL} since we don't know how to set labels for fs_type $fs_type"); delete $part->{device_LABEL}; delete $part->{prefer_device_LABEL}; + delete $part->{device_LABEL_changed}; } } } -- cgit v1.2.1