summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2017-03-12 18:51:16 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2017-03-14 22:22:31 +0000
commitaf4fa8371fa40bb5012a7af40f0f667059e8a138 (patch)
treedf2b4e57705546b32181d1aee15213d3e09958df /perl-install/partition_table
parent679ea1e5ab5c570b461cf3dacfe0fb61a04e9d79 (diff)
downloaddrakx-af4fa8371fa40bb5012a7af40f0f667059e8a138.tar
drakx-af4fa8371fa40bb5012a7af40f0f667059e8a138.tar.gz
drakx-af4fa8371fa40bb5012a7af40f0f667059e8a138.tar.bz2
drakx-af4fa8371fa40bb5012a7af40f0f667059e8a138.tar.xz
drakx-af4fa8371fa40bb5012a7af40f0f667059e8a138.zip
Ensure kernel is informed when a DOS partition table is cleared.
diskdrake allows the user to clear all partitions even when some of those partitions are currently mounted. partition_table::dos::need_to_tell_kernel() must return true in this case, as the automatic reread of the partition table triggered by udevd will fail.
Diffstat (limited to 'perl-install/partition_table')
-rw-r--r--perl-install/partition_table/dos.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index 135d02208..a97fcf89d 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -288,13 +288,18 @@ sub need_to_tell_kernel {
# The udev/rules.d/60-block.rules file causes the raw disk devices to be watched by udev. This file is
# not present in the cut-down system used to run the classic installer, so we always need to tell the
# kernel in that case.
- return ! -e '/usr/lib/udev/rules.d/60-block.rules' || any { $_->{isMounted} } partition_table::get_normal_parts($hd);
+ # diskdrake will not let the user delete an individual partition that is mounted, but will let the
+ # user clear all partitions. So initialize() records if any partitions were mounted and we take note
+ # of that here.
+ return ! -e '/usr/lib/udev/rules.d/60-block.rules' || delete $hd->{hadMountedPartitions} || any { $_->{isMounted} } partition_table::get_normal_parts($hd);
}
sub empty_raw { { raw => [ ({}) x $nb_primary ] } }
sub initialize {
my ($class, $hd) = @_;
+ # Remember whether any existing partitions are mounted, for use by need_to_tell_kernel().
+ $hd->{hadMountedPartitions} = 1 if any { $_->{isMounted} } partition_table::get_normal_parts($hd);
$hd->{primary} = empty_raw();
bless $hd, $class;
}