summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table.pm')
-rw-r--r--perl-install/partition_table.pm20
1 files changed, 14 insertions, 6 deletions
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 86795e8e6..e62cd3dab 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -1,4 +1,4 @@
-package partition_table; # $Id: partition_table.pm 245972 2008-09-18 17:00:11Z pixel $
+package partition_table; # $Id: partition_table.pm 268438 2010-05-10 14:25:50Z pterjan $
use diagnostics;
use strict;
@@ -260,7 +260,8 @@ sub read_primary {
#- but other sectors (typically for extended partition ones) have to match this type!
my @parttype = (
if_(arch() =~ /^ia64/, 'gpt'),
- arch() =~ /^sparc/ ? ('sun', 'bsd') : ('lvm', 'dmcrypt', 'dos', 'bsd', 'sun', 'mac'),
+ # gpt must be tried before dos as it presents a fake compatibility mbr
+ arch() =~ /^sparc/ ? ('sun', 'bsd') : ('gpt', 'lvm', 'dmcrypt', 'dos', 'bsd', 'sun', 'mac'),
);
foreach ('empty', @parttype, 'unknown') {
/unknown/ and die "unknown partition table format on disk " . $hd->{file};
@@ -383,11 +384,11 @@ sub tell_kernel {
my $F = partition_table::raw::openit($hd);
+ run_program::run('udevadm', 'control', '--stop-exec-queue') unless $::isInstall;
+
my $force_reboot = any { $_->[0] eq 'force_reboot' } @$tell_kernel;
if (!$force_reboot) {
- # only keep the last action on the partition number
- # that way we do not del/add the same partition, and this helps udev :)
- foreach (reverse(uniq_ { $_->[1] } reverse @$tell_kernel)) {
+ foreach (@$tell_kernel) {
my ($action, $part_number, $o_start, $o_size) = @$_;
if ($action eq 'add') {
@@ -398,7 +399,11 @@ sub tell_kernel {
log::l("tell kernel $action ($hd->{device} $part_number $o_start $o_size) force_reboot=$force_reboot rebootNeeded=$hd->{rebootNeeded}");
}
}
+
+ run_program::run('udevadm', 'control', '--start-exec-queue') unless $::isInstall;
+
if ($force_reboot) {
+ # FIXME Handle LVM/dmcrypt/RAID
my @magic_parts = grep { $_->{isMounted} && $_->{real_mntpoint} } get_normal_parts($hd);
foreach (@magic_parts) {
syscall_('umount', $_->{real_mntpoint}) or log::l(N("error unmounting %s: %s", $_->{real_mntpoint}, $!));
@@ -453,6 +458,9 @@ sub write {
tell_kernel($hd, $tell_kernel);
}
}
+ # get major/minor again after writing the partition table so that we got them for dynamic devices
+ # (eg: for SCSI like devices with kernel-2.6.28+):
+ fs::get_major_minor([ get_normal_parts($hd) ]);
}
sub active {
@@ -567,7 +575,7 @@ The only solution is to move your primary partitions to have the hole next to th
sub add {
my ($hd, $part, $b_primaryOrExtended, $b_forceNoAdjust) = @_;
- get_normal_parts($hd) >= ($hd->{device} =~ /^rd/ ? 7 : $hd->{device} =~ /^(sd|ida|cciss|ataraid)/ ? 15 : 63) and cdie "maximum number of partitions handled by linux reached";
+ get_normal_parts($hd) >= ($hd->{device} =~ /^rd/ ? 7 : $hd->{device} =~ /^(ida|cciss|ataraid)/ ? 15 : 63) and cdie "maximum number of partitions handled by linux reached";
set_isFormatted($part, 0);
put_in_hash($part, hd2minimal_part($hd));