From 56b573476e2ea63a509ab2f8ec0683397ae7c85e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 8 Aug 2007 10:42:16 +0000 Subject: - diskdrake: o do not show partition types which have no associated filesystem for LVM LV (#32326) nb: we still would need to have pt_type per partition_table types --- perl-install/NEWS | 4 ++++ perl-install/diskdrake/interactive.pm | 6 +++--- perl-install/fs/type.pm | 10 ++++++++-- perl-install/install/NEWS | 3 +++ perl-install/lvm.pm | 1 + perl-install/partition_table/bsd.pm | 3 +++ perl-install/partition_table/dos.pm | 1 + perl-install/partition_table/gpt.pm | 2 ++ perl-install/partition_table/mac.pm | 2 ++ perl-install/partition_table/raw.pm | 1 + perl-install/partition_table/sun.pm | 2 ++ 11 files changed, 30 insertions(+), 5 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index 6331b0d66..09b43f802 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,7 @@ +- diskdrake: + o do not show partition types which have no associated filesystem + for LVM LV (#32326) + Version 10.4.161 - 06 August 2007, by Thierry Vignaud - drakbug: diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 6307a3bc5..acca8f01e 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -497,7 +497,7 @@ sub Create { ), { label => N("Size in MB: "), val => \$mb_size, min => to_Mb(min_partition_size($hd)), max => to_Mb($def_size), type => 'range', SpinButton => $::expert, changed => sub { $part->{start} = min($part->{start}, $max - $mb_size * 2048) } }, - { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ], + { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert, $hd) ], sort => 0, if_($::expert, gtk => { wrap_width => 4 }) }, { label => N("Mount point: "), val => \$part->{mntpoint}, list => [ fsedit::suggestions_mntpoint($all_hds), '' ], disabled => sub { my $p = fs::type::type_name2subpart($type_name); isSwap($p) || isNonMountable($p) }, type => 'combo', not_edit => 0, @@ -584,7 +584,7 @@ sub Type { #- for ext2, warn after choosing as ext2->ext3 can be achieved without loosing any data :) $part->{fs_type} eq 'ext2' || $part->{fs_type} =~ /ntfs/ or $warn->() or return; - my @types = fs::type::type_names($::expert); + my @types = fs::type::type_names($::expert, $hd); #- when readonly, Type() is allowed only when changing {fs_type} but not {pt_type} #- eg: switching between ext2, ext3, reiserfs... @@ -927,7 +927,7 @@ sub Loopback { $in->ask_from(N("Loopback"), '', [ { label => N("Loopback file name: "), val => \$part->{loopback_file} }, { label => N("Size in MB: "), val => \$mb_size, min => to_Mb($min), max => to_Mb($max), type => 'range', SpinButton => $::expert }, - { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ], not_edit => !$::expert, sort => 0 }, + { label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert, $hd) ], not_edit => !$::expert, sort => 0 }, ], complete => sub { $part->{loopback_file} or $in->ask_warn(N("Give a file name"), N("Give a file name")), return 1, 0; diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm index cce7cdf23..79a89e819 100644 --- a/perl-install/fs/type.pm +++ b/perl-install/fs/type.pm @@ -179,10 +179,16 @@ if_(arch() !~ /ppc/, sub type_names { - my ($expert) = @_; + my ($expert, $o_hd) = @_; my @l = @{$type_names{important}}; push @l, @{$type_names{less_important}}, sort @{$type_names{other}} if $expert; - @l; + if ($o_hd && !$o_hd->use_pt_type) { + warn "$_ => $type_name2fs_type{$_}\n" foreach @l; + @l = grep { $type_name2fs_type{$_} } @l; + uniq_ { $type_name2fs_type{$_[0]} } @l; + } else { + @l; + } } sub type_name2subpart { diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 6161872f3..7761eb032 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,6 @@ +- diskdrake: + o do not show partition types which have no associated filesystem + for LVM LV (#32326) - allow using diskdrake even if there is only a lvm PV on full disk available - fix range max value >2TB when creating a partition (useful for LVs >2TB) - kill security level step (only reachable from summary now) diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm index 018811ea1..2c51b2768 100644 --- a/perl-install/lvm.pm +++ b/perl-install/lvm.pm @@ -19,6 +19,7 @@ sub new { $name = substr($name, 0, 63); # max length must be < NAME_LEN / 2 where NAME_LEN is 128 bless { disks => [], VG_name => $name }, $class; } +sub use_pt_type { 0 } sub hasExtended { 0 } sub adjustStart {} sub adjustEnd {} diff --git a/perl-install/partition_table/bsd.pm b/perl-install/partition_table/bsd.pm index 0e2421c25..560a75fd9 100644 --- a/perl-install/partition_table/bsd.pm +++ b/perl-install/partition_table/bsd.pm @@ -58,6 +58,9 @@ my $magic = 0x82564557; my $nb_primary = 8; my $offset = 0x40; + +sub use_pt_type { 1 } + sub read($$) { my ($hd, $sector) = @_; my $tmp; diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm index 0ac56d453..43243259d 100644 --- a/perl-install/partition_table/dos.pm +++ b/perl-install/partition_table/dos.pm @@ -19,6 +19,7 @@ my $nb_primary = 4; my $offset = $common::SECTORSIZE - length($magic) - $nb_primary * common::psizeof($format); +sub use_pt_type { 1 } sub hasExtended { 1 } sub geometry_to_string { diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index 82ce9527e..de83dadf8 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -223,6 +223,8 @@ sub raw_add { push @$raw, $part; } +sub use_pt_type { 1 } + sub adjustStart {} sub adjustEnd {} diff --git a/perl-install/partition_table/mac.pm b/perl-install/partition_table/mac.pm index ef638f2b6..8d653932f 100644 --- a/perl-install/partition_table/mac.pm +++ b/perl-install/partition_table/mac.pm @@ -79,6 +79,8 @@ $p_format = join '', @$p_format; my $magic = 0x4552; my $pmagic = 0x504D; +sub use_pt_type { 1 } + sub first_usable_sector { 1 } sub adjustStart($$) { diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm index 35a67ebd8..f84876f04 100644 --- a/perl-install/partition_table/raw.pm +++ b/perl-install/partition_table/raw.pm @@ -55,6 +55,7 @@ if_(arch() =~ /ppc/, sub typeOfMBR($) { typeFromMagic(devices::make($_[0]), @MBR_signatures) } sub typeOfMBR_($) { typeFromMagic($_[0], @MBR_signatures) } +sub use_pt_type { 0 } sub hasExtended { 0 } sub set_best_geometry_for_the_partition_table {} diff --git a/perl-install/partition_table/sun.pm b/perl-install/partition_table/sun.pm index 54e734ca8..49228d0f8 100644 --- a/perl-install/partition_table/sun.pm +++ b/perl-install/partition_table/sun.pm @@ -39,6 +39,8 @@ my $magic = 0xDABE; my $nb_primary = 8; my $offset = 0; +sub use_pt_type { 1 } + sub adjustStart($$) { my ($hd, $part) = @_; my $end = $part->{start} + $part->{size}; -- cgit v1.2.1