From a0c99bbcd7be82b0733f314e404147cbd5cc69e1 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 3 Mar 2008 14:11:58 +0000 Subject: - auto allocate: do not create /home if drive is smaller than 7GB --- perl-install/diskdrake/interactive.pm | 1 + perl-install/fsedit.pm | 16 +++++++++------- perl-install/install/NEWS | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'perl-install') diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 0b5d79a34..07a21c610 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -73,6 +73,7 @@ struct part { struct part_allocate inherits part { int maxsize # in sectors (alike "size") + int min_hd_size # in sectors (do not allocate if the drive is smaller than the given size) int ratio # string hd # 'hda', 'hdc' string parts # for creating raid partitions. eg: 'foo bar' where 'foo' and 'bar' are mntpoint diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 6260c9271..5c82a2429 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -22,19 +22,19 @@ use fs; %suggestions = ( N_("simple") => [ { mntpoint => "/", size => MB(300), fs_type => 'ext3', ratio => 20, maxsize => MB(8000) }, - { mntpoint => "swap", size => MB(64), fs_type => 'swap', ratio => 1, maxsize => MB(4000) }, - { mntpoint => "/home", size => MB(300), fs_type => 'ext3', ratio => 3 }, + { mntpoint => "swap", size => MB(128), fs_type => 'swap', ratio => 1, maxsize => MB(4000) }, + { mntpoint => "/home", size => MB(300), fs_type => 'ext3', ratio => 3, min_hd_size => MB(7000) }, ], N_("with /usr") => [ - { mntpoint => "/", size => MB(250), fs_type => 'ext3', ratio => 1, maxsize => MB(4000) }, + { mntpoint => "/", size => MB(250), fs_type => 'ext3', 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 => 'ext3', ratio => 4, maxsize => MB(8000) }, - { mntpoint => "/home", size => MB(100), fs_type => 'ext3', ratio => 3 }, + { mntpoint => "/home", size => MB(100), fs_type => 'ext3', ratio => 3, min_hd_size => MB(7000) }, ], N_("server") => [ - { mntpoint => "/", size => MB(150), fs_type => 'ext3', ratio => 1, maxsize => MB(4000) }, + { mntpoint => "/", size => MB(150), fs_type => 'ext3', 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 => 'ext3', ratio => 4, maxsize => MB(8000) }, { mntpoint => "/var", size => MB(200), fs_type => 'ext3', ratio => 3 }, - { mntpoint => "/home", size => MB(150), fs_type => 'ext3', ratio => 3 }, + { mntpoint => "/home", size => MB(150), fs_type => 'ext3', ratio => 3, min_hd_size => MB(7000) }, { mntpoint => "/tmp", size => MB(150), fs_type => 'ext3', ratio => 2, maxsize => MB(4000) }, ], ); @@ -346,10 +346,12 @@ sub suggest_part { fs::type::set_pt_type($_, $_->{pt_type}) if !exists $_->{fs_type}; } + my $hd_size = fs::get::part2hd($part, $all_hds)->{totalsectors}; my $has_swap = any { isSwap($_) } fs::get::fstab($all_hds); my @local_suggestions = grep { !$_->{mntpoint} && !$_->{VG_name} || !fs::get::has_mntpoint($_->{mntpoint}, $all_hds) || isSwap($_) && !$has_swap } + grep { !$_->{min_hd_size} || $_->{min_hd_size} <= $hd_size } grep { !$_->{hd} || $_->{hd} eq $part->{rootDevice} } @$suggestions; @@ -357,7 +359,7 @@ sub suggest_part { #- one should rather use {ratio} instead foreach (@local_suggestions) { if ($_->{percent_size} && $_->{percent_size} =~ /(.+?)%?$/) { - $_->{size} = $1 / 100 * fs::get::part2hd($part, $all_hds)->{totalsectors}; + $_->{size} = $1 / 100 * $hd_size; log::l("in suggestion, setting size=$_->{size} for percent_size=$_->{percent_size}"); } } diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 4608a371c..152a07d07 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,5 @@ +- auto allocate: do not create /home if drive is smaller than 7GB + Version 10.6.25 - 28 February 2008 - API changes for draklive-install -- cgit v1.2.1