diff options
Diffstat (limited to 'perl-install/fsedit.pm')
| -rw-r--r-- | perl-install/fsedit.pm | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 5eb5e153c..ddae28481 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -1,8 +1,9 @@ -package fsedit; # $Id: fsedit.pm 269284 2010-05-24 15:36:50Z pterjan $ +package fsedit; use diagnostics; use strict; use vars qw(%suggestions); +use feature 'state'; #-###################################################################################### #- misc imports @@ -22,32 +23,41 @@ use fs; # min_hd_size: only suggest this partition if the hd size is bigger than that %suggestions = ( N_("simple") => [ - { mntpoint => "/", size => MB(300), fs_type => defaultFS(), ratio => 10, maxsize => MB(12300) }, - { mntpoint => "swap", size => MB(128), fs_type => 'swap', ratio => 1, maxsize => MB(4000) }, - { mntpoint => "/home", size => MB(300), fs_type => defaultFS(), ratio => 8, min_hd_size => MB(8000) }, + { mntpoint => "/", size => MB(300), fs_type => defaultFS(), ratio => 6, maxsize => MB(51500) }, + { mntpoint => "swap", size => MB(256), fs_type => 'swap', ratio => 1, maxsize => MB(4096) }, + { mntpoint => "/home", size => MB(300), fs_type => defaultFS(), ratio => 12, min_hd_size => MB(51200) }, ], N_("with /usr") => [ { mntpoint => "/", size => MB(250), fs_type => defaultFS(), ratio => 1, maxsize => MB(8000) }, { mntpoint => "swap", size => MB(64), fs_type => 'swap', ratio => 1, maxsize => MB(4000) }, { mntpoint => "/usr", size => MB(300), fs_type => defaultFS(), ratio => 4, maxsize => MB(8000) }, - { mntpoint => "/home", size => MB(100), fs_type => defaultFS(), ratio => 3, min_hd_size => MB(7000) }, + { mntpoint => "/home", size => MB(100), fs_type => defaultFS(), ratio => 3, min_hd_size => MB(10000) }, ], N_("server") => [ { mntpoint => "/", size => MB(150), fs_type => defaultFS(), ratio => 1, maxsize => MB(8000) }, { mntpoint => "swap", size => MB(64), fs_type => 'swap', ratio => 2, maxsize => MB(4000) }, { mntpoint => "/usr", size => MB(300), fs_type => defaultFS(), ratio => 4, maxsize => MB(8000) }, { mntpoint => "/var", size => MB(200), fs_type => defaultFS(), ratio => 3 }, - { mntpoint => "/home", size => MB(150), fs_type => defaultFS(), ratio => 3, min_hd_size => MB(7000) }, + { mntpoint => "/home", size => MB(150), fs_type => defaultFS(), ratio => 3, min_hd_size => MB(10000) }, { mntpoint => "/tmp", size => MB(150), fs_type => defaultFS(), ratio => 2, maxsize => MB(4000) }, ], ); -foreach (values %suggestions) { - if (arch() =~ /ia64/) { - @$_ = ({ mntpoint => "/boot/efi", size => MB(50), pt_type => 0xef, ratio => 1, maxsize => MB(150) }, @$_); + +sub init_efi_suggestions { + my ($fstab, $o_force) = @_; + state $done; + return if $done && !$o_force; + $done++; + + # only suggests /boot/EFI if there's not already one: + return if !is_uefi() || grep { isESP($_) } @$fstab; + + foreach (values %suggestions) { + @$_ = ({ mntpoint => "/boot/EFI", size => MB(100), pt_type => 0xef, ratio => 1, maxsize => MB(300) }, @$_); } } my @suggestions_mntpoints = ( "/var/ftp", "/var/www", "/boot", '/usr/local', '/opt', - arch() =~ /sparc/ ? "/mnt/sunos" : arch() =~ /ppc/ ? "/mnt/macos" : "/mnt/windows", + "/mnt/windows", ); #-###################################################################################### @@ -226,7 +236,7 @@ sub get_hds { die sprintf(q(bad dmraid (missing partition %s), you may try rebooting install with option "nodmraid"), $p->{device}); } } else { - fs::proc_partitions::compare($hd) if !detect_devices::is_xbox() && arch() ne 'ppc'; + fs::proc_partitions::compare($hd) if !detect_devices::is_xbox(); } } } sub { @@ -266,6 +276,9 @@ Do you agree to lose all the partitions? my @parts = partition_table::get_normal_parts($hd); + # fix installer failures due to udev's race when run too early: + run_program::run('udevadm', 'settle'); + # checking the magic of the filesystem, do not rely on pt_type foreach (@parts) { if (my $type = fs::type::type_subpart_from_magic($_)) { @@ -462,7 +475,7 @@ Please be sure to add a separate /boot partition"); } if ($mntpoint eq "/boot" && (isLUKS($part) || isRawLUKS($part))) { - die N("You cannot use an encrypted file system for mount point %s", "/boot"); + die N("You cannot use an encrypted filesystem for mount point %s", "/boot"); } #- NB: if the LV doesn't exist, lv_nb_pvs returns 0 @@ -478,9 +491,9 @@ You should create a separate /boot partition first") if $mntpoint eq "/" && isLV if member($mntpoint, qw(/bin /dev /etc /lib /sbin /mnt /media)); die N("You need a true filesystem (ext2/3/4, reiserfs, xfs, or jfs) for this mount point\n") if !isTrueLocalFS($part) && $mntpoint eq '/'; - die N("You need a true filesystem (ext2/3/4, reiserfs, xfs, or jfs) for this mount point\n") - if !isTrueFS($part) && member($mntpoint, '/home', fs::type::directories_needed_to_boot()); - die N("You cannot use an encrypted file system for mount point %s", $mntpoint) + die N("You need a true filesystem (ext2/3/4, reiserfs, xfs, or jfs) for this mount point\n") . $mntpoint + if !isTrueFS($part) && member($mntpoint, '/home', fs::type::directories_needed_to_boot_not_ESP()); + die N("You cannot use an encrypted filesystem for mount point %s", $mntpoint) if $part->{options} =~ /encrypted/ && member($mntpoint, qw(/ /usr /var /boot)); local $part->{mntpoint} = $mntpoint; @@ -505,12 +518,13 @@ sub add { } sub allocatePartitions { - my ($all_hds, $to_add) = @_; + my ($all_hds, $to_add, $o_hd) = @_; my @to_add = @$to_add; foreach my $part_ (fs::get::holes($all_hds, 'non_readonly')) { my ($start, $size, $dev) = @$part_{"start", "size", "rootDevice"}; + next if $o_hd && (($o_hd->{device} || $o_hd->{VG_name}) ne $dev); my ($part, $suggested); while ($suggested = suggest_part($part = { start => $start, size => 0, maxsize => $size, rootDevice => $dev }, $all_hds, \@to_add)) { @@ -524,11 +538,11 @@ sub allocatePartitions { } sub auto_allocate { - my ($all_hds, $o_suggestions) = @_; + my ($all_hds, $o_suggestions, $o_target) = @_; my $before = listlength(fs::get::fstab($all_hds)); my $suggestions = $o_suggestions || $suggestions{simple}; - allocatePartitions($all_hds, $suggestions); + allocatePartitions($all_hds, $suggestions, $o_target); if ($o_suggestions) { auto_allocate_raids($all_hds, $suggestions); @@ -550,6 +564,8 @@ sub auto_allocate { die N("Nothing to do"); } } + my @fstab = fs::get::fstab($all_hds); + fs::mount_point::suggest_mount_points_always(\@fstab); } sub auto_allocate_raids { |
