diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/diskdrake/interactive.pm | 3 | ||||
-rw-r--r-- | perl-install/fs/mount_options.pm | 4 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 2 | ||||
-rw-r--r-- | perl-install/partition_table.pm | 19 |
4 files changed, 20 insertions, 8 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index a22773bf5..679235d95 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -41,6 +41,7 @@ struct part { string comment # comment to have in fstab string volume_label # + bool is_removable # is the partition on a removable drive bool isMounted bool isFormatted @@ -498,7 +499,7 @@ sub Create { put_in_hash($part, fs::type::type_name2subpart($type_name)); $part->{mntpoint} = '' if isNonMountable($part); $part->{mntpoint} = 'swap' if isSwap($part); - fs::mount_options::set_default($part); + fs::mount_options::set_default($part, ignore_is_removable => 1); check($in, $hd, $part, $all_hds) or return 1; $migrate_files = need_migration($in, $part->{mntpoint}) or return 1; diff --git a/perl-install/fs/mount_options.pm b/perl-install/fs/mount_options.pm index 1ce622721..c7baa4e7b 100644 --- a/perl-install/fs/mount_options.pm +++ b/perl-install/fs/mount_options.pm @@ -160,11 +160,11 @@ sub rationalize { sub set_default { my ($part, %opts) = @_; - #- opts are: useSupermount security iocharset codepage + #- opts are: useSupermount security iocharset codepage ignore_is_removable my ($options, $unknown) = &unpack($part); - if ($part->{is_removable} && !member($part->{mntpoint}, qw(/ /usr /var /boot))) { + if (!$opts{ignore_is_removable} && $part->{is_removable} && !member($part->{mntpoint}, qw(/ /usr /var /boot))) { $options->{supermount} = $opts{useSupermount} && !($opts{useSupermount} eq 'magicdev' && $part->{media_type} eq 'cdrom'); $part->{fs_type} = !$options->{supermount} ? 'auto' : $part->{media_type} eq 'cdrom' ? 'udf:iso9660' : 'ext2:vfat'; diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 37c6b7dd9..89dc2a090 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -248,7 +248,7 @@ sub read_proc_partitions { } else { $dev = $part->{dev}; if (my $hd = find { $part->{dev} =~ /^$_->{device}./ } @$hds) { - $part->{rootDevice} = $hd->{device}; + put_in_hash($part, partition_table::hd2minimal_part($hd)); } } undef $prev_part if $prev_part && ($prev_part->{rootDevice} || '') ne ($part->{rootDevice} || ''); diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index caa231238..edb061bdb 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -12,6 +12,14 @@ use log; our @fields2save = qw(primary extended totalsectors isDirty will_tell_kernel); +sub hd2minimal_part { + my ($hd) = @_; + { + rootDevice => $hd->{device}, + if_($hd->{usb_media_type}, is_removable => 1), + }; +} + #- works for both hard drives and partitions ;p sub description { my ($hd) = @_; @@ -202,14 +210,17 @@ sub get_normal_parts_and_holes { ref($hd) or print("get_normal_parts_and_holes: bad hd" . backtrace(), "\n"); + my $minimal_hole = put_in_hash({ pt_type => 0 }, hd2minimal_part($hd)); + my @l = map { my $current = $start; $start = $_->{start} + $_->{size}; - my $hole = { start => $current, size => $_->{start} - $current, pt_type => 0, rootDevice => $hd->{device} }; + my $hole = { start => $current, size => $_->{start} - $current, %$minimal_hole }; + put_in_hash($hole, hd2minimal_part($hd)); $hole, $_; } sort { $a->{start} <=> $b->{start} } grep { !isWholedisk($_) } get_normal_parts($hd); - push @l, { start => $start, size => $last - $start, pt_type => 0, rootDevice => $hd->{device} }; + push @l, { start => $start, size => $last - $start, %$minimal_hole }; grep { $_->{pt_type} || $_->{size} >= $hd->cylinder_size } @l; } @@ -252,7 +263,7 @@ sub read_one($$) { @extended > 1 and die "more than one extended partition"; - $_->{rootDevice} = $hd->{device} foreach @normal, @extended; + put_in_hash($_, hd2minimal_part($hd)) foreach @normal, @extended; { raw => $pt, extended => $extended[0], normal => \@normal, info => $info, nb_special_empty => $nb_special_empty }; } @@ -532,7 +543,7 @@ sub add { 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"; set_isFormatted($part, 0); - $part->{rootDevice} = $hd->{device}; + put_in_hash($part, hd2minimal_part($hd)); $part->{start} ||= 1 if arch() !~ /^sparc/; #- starting at sector 0 is not allowed adjustStartAndEnd($hd, $part) unless $b_forceNoAdjust; |