summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2015-03-28 02:46:14 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2015-05-20 06:16:49 -0400
commit85ab4aeb0467b989fdd1d86c270f8174b34409e6 (patch)
tree7161a71b7bbbc025b397a1022a19f2573c56e6e0 /perl-install
parente9510aa50ed1207ca154e8bc81e365e71a6f929c (diff)
downloaddrakx-85ab4aeb0467b989fdd1d86c270f8174b34409e6.tar
drakx-85ab4aeb0467b989fdd1d86c270f8174b34409e6.tar.gz
drakx-85ab4aeb0467b989fdd1d86c270f8174b34409e6.tar.bz2
drakx-85ab4aeb0467b989fdd1d86c270f8174b34409e6.tar.xz
drakx-85ab4aeb0467b989fdd1d86c270f8174b34409e6.zip
simplify
needed for next commit
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/partition_table/gpt.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index 0f0f45c6a..e8b521912 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -102,6 +102,12 @@ my %_GUID_to_Label = (
"89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE" => "Ceph dm-crypt disk in creation",
);
+my %parted_mapping = (
+ 'linux-swap(v1)' => 'swap',
+ 'ntfs' => 'ntfs-3g',
+ );
+my %rev_parted_mapping = reverse %parted_mapping;
+
sub read_one {
my ($hd, $_sector) = @_;
@@ -120,8 +126,7 @@ sub read_one {
} elsif ($_->{flag} eq 'RECOVERY') {
$_->{pt_type} = 0x12;
}
- $_->{fs_type} = 'swap' if $_->{fs_type} eq 'linux-swap(v1)';
- $_->{fs_type} = 'ntfs-3g' if $_->{fs_type} eq 'ntfs';
+ $_->{fs_type} = $parted_mapping{$_->{fs_type}} if $parted_mapping{$_->{fs_type}};
@pt[$_->{part_number}-1] = $_;
}
@@ -149,8 +154,7 @@ sub write {
my ($part) = grep { $_->{start} == $o_start && $_->{size} == $o_size } @$pt;
print "($action, $part_number, $o_start, $o_size)\n";
if ($action eq 'add') {
- local $part->{fs_type} = 'linux-swap(v1)' if isSwap($part->{fs_type});
- local $part->{fs_type} = 'ntfs' if $part->{fs_type} eq 'ntfs-3g';
+ local $part->{fs_type} = $rev_parted_mapping{$part->{fs_type}} if $rev_parted_mapping{$part->{fs_type}};
c::disk_add_partition($hd->{file}, $o_start, $o_size, $part->{fs_type}) or die "failed to add partition #$part_number on $hd->{file}";
my $flag;
if (isESP($part)) {