summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table')
-rw-r--r--perl-install/partition_table/bsd.pm2
-rw-r--r--perl-install/partition_table/dos.pm4
-rw-r--r--perl-install/partition_table/gpt.pm4
-rw-r--r--perl-install/partition_table/mac.pm17
-rw-r--r--perl-install/partition_table/sun.pm6
5 files changed, 19 insertions, 14 deletions
diff --git a/perl-install/partition_table/bsd.pm b/perl-install/partition_table/bsd.pm
index cdf18e6d1..0e2421c25 100644
--- a/perl-install/partition_table/bsd.pm
+++ b/perl-install/partition_table/bsd.pm
@@ -73,7 +73,7 @@ sub read($$) {
my $size = psizeof($format);
my @pt = map {
my %h; @h{@fields} = unpack $format, $_;
- $h{pt_type} = $pt_typeToDos{$h{pt_type}} || $h{pt_type};
+ fs::type::set_pt_type(\%h, $pt_typeToDos{$h{pt_type}} || $h{pt_type});
\%h;
} $info{partitions} =~ /(.{$size})/g;
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index 38cdf60ed..8c30e6558 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -185,7 +185,9 @@ sub read {
my @pt = map {
sysread $F, $tmp, psizeof($format) or die "error while reading partition table in sector $sector";
- my %h; @h{@fields} = unpack $format, $tmp;
+ my %h;
+ @h{@fields} = unpack $format, $tmp;
+ fs::type::set_pt_type(\%h, $h{pt_type});
\%h;
} (1..$nb_primary);
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index 2f1506bbd..423d73a7a 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -130,8 +130,8 @@ sub read_partitionEntries {
sysread $F, $tmp, psizeof($partitionEntry_format) or die "error while reading partition table in sector $info->{partitionEntriesLBA}";
my %h; @h{@$partitionEntry_fields} = unpack $partitionEntry_format, $tmp;
$h{size} = $h{ending} - $h{start} + 1;
- $h{pt_type} = $gpt_types_rev{$h{gpt_type}};
- $h{pt_type} = 0x100 if !defined $h{pt_type};
+ my $pt_type = $gpt_types_rev{$h{gpt_type}};
+ fs::type::set_pt_type(\%h, defined $pt_type ? $pt_type : 0x100);
\%h;
} (1 .. $info->{nbPartitions});
\@pt;
diff --git a/perl-install/partition_table/mac.pm b/perl-install/partition_table/mac.pm
index 219b6434d..4b60710bb 100644
--- a/perl-install/partition_table/mac.pm
+++ b/perl-install/partition_table/mac.pm
@@ -7,6 +7,7 @@ use vars qw(@ISA $freepart $bootstrap_part $macos_part);
@ISA = qw(partition_table::raw);
use common;
+use fs::type;
use partition_table::raw;
use partition_table;
use c;
@@ -139,7 +140,7 @@ sub read($$) {
$h{start} = ($h{pPBlockStart} * $info{bzBlkSize}) / 512;
if ($h{pType} =~ /^Apple_UNIX_SVR2/i) {
- $h{pName} =~ /swap/i ? ($h{pt_type} = 0x82) : ($h{pt_type} = 0x83);
+ $h{fs_type} = $h{pName} =~ /swap/i ? 'swap' : 'ext2';
} elsif ($h{pType} =~ /^Apple_Free/i) {
#- need to locate a 1MB partition to setup a bootstrap on
if ($freepart && $freepart->{size} >= 1) {
@@ -151,7 +152,7 @@ sub read($$) {
$h{pt_type} = 0x0;
$h{pName} = 'Extra';
} elsif ($h{pType} =~ /^Apple_HFS/i) {
- $h{pt_type} = 0x402;
+ fs::type::set_pt_type(\%h, 0x402);
if (defined $macos_part) {
#- swag at identifying MacOS - 1st HFS partition
} else {
@@ -297,27 +298,27 @@ sub write($$$;$) {
log::l("writing a bootstrap at /dev/$_->{device}");
$install_steps_interactive::new_bootstrap = 1 if !(defined $partition_table::mac::bootstrap_part);
$bootstrap_part = "/dev/" . $_->{device};
- } elsif ($_->{pt_type} == 0x82) {
+ } elsif (isSwap($_)) {
$_->{pType} = "Apple_UNIX_SVR2";
$_->{pName} = "swap";
$_->{pFlags} = 0x33;
- } elsif ($_->{pt_type} == 0x83) {
+ } elsif ($_->{fs_type} eq 'ext2') {
$_->{pType} = "Apple_UNIX_SVR2";
$_->{pName} = "Linux Native";
$_->{pFlags} = 0x33;
- } elsif ($_->{pt_type} == 0x183) {
+ } elsif ($_->{fs_type} eq 'reiserfs') {
$_->{pType} = "Apple_UNIX_SVR2";
$_->{pName} = "Linux ReiserFS";
$_->{pFlags} = 0x33;
- } elsif ($_->{pt_type} == 0x283) {
+ } elsif ($_->{fs_type} eq 'xfs') {
$_->{pType} = "Apple_UNIX_SVR2";
$_->{pName} = "Linux XFS";
$_->{pFlags} = 0x33;
- } elsif ($_->{pt_type} == 0x383) {
+ } elsif ($_->{fs_type} eq 'jfs') {
$_->{pType} = "Apple_UNIX_SVR2";
$_->{pName} = "Linux JFS";
$_->{pFlags} = 0x33;
- } elsif ($_->{pt_type} == 0x483) {
+ } elsif ($_->{fs_type} eq 'ext3') {
$_->{pType} = "Apple_UNIX_SVR2";
$_->{pName} = "Linux ext3";
$_->{pFlags} = 0x33;
diff --git a/perl-install/partition_table/sun.pm b/perl-install/partition_table/sun.pm
index 7c8a6beb9..54e734ca8 100644
--- a/perl-install/partition_table/sun.pm
+++ b/perl-install/partition_table/sun.pm
@@ -9,6 +9,7 @@ use vars qw(@ISA);
use common;
use partition_table::raw;
use partition_table;
+use fs::type;
use c;
my ($main_format, $main_fields) = list2kv(
@@ -92,8 +93,9 @@ sub read($$) {
my @infos_up = unpack $format1 x $nb_primary, $info{infos};
my @partitions_up = unpack $format2 x $nb_primary, $info{partitions};
foreach (0..$nb_primary-1) {
- my $h = { pt_type => $infos_up[2 * $_], flag => $infos_up[1 + 2 * $_],
+ my $h = { flag => $infos_up[1 + 2 * $_],
start_cylinder => $partitions_up[2 * $_], size => $partitions_up[1 + 2 * $_] };
+ fs::type::set_pt_type($h, $infos_up[2 * $_]);
$h->{start} = $sector + $h->{start_cylinder} * $hd->cylinder_size;
$h->{pt_type} && $h->{size} or $h->{$_} = 0 foreach keys %$h;
push @pt, $h;
@@ -133,7 +135,7 @@ sub write($$$;$) {
# $csize += $_->{size} if $_->{pt_type} != 5;
# $wdsize += $_->{size} if $_->{pt_type} == 5;
$_->{flags} |= 0x10 if $_->{mntpoint} eq '/';
- $_->{flags} |= 0x01 if partition_table::isSwap($_);
+ $_->{flags} |= 0x01 if !isSwap($_);
local $_->{start_cylinder} = $_->{start} / $hd->cylinder_size - $sector;
pack($format1, @$_{@$fields1}), pack($format2, @$_{@$fields2});
} @$pt;