diff options
-rw-r--r-- | perl-install/any.pm | 8 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 43 | ||||
-rw-r--r-- | perl-install/install2.pm | 62 | ||||
-rw-r--r-- | perl-install/install_interactive.pm | 8 |
4 files changed, 38 insertions, 83 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index a5b3f3074..ccad02480 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -253,6 +253,14 @@ arch() !~ /sparc/ ? ( 1; } +sub partitions_suggestions { + my ($in) = @_; + my $t = $::expert ? + $in->ask_from_list_('', _("What type of partitioning?"), [ keys %fsedit::suggestions ]) : + 'simple'; + $fsedit::suggestions{$t}; +} + my @etc_pass_fields = qw(name pw uid gid realname home shell); sub unpack_passwd { my ($l) = @_; diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index fde649d57..6d321121b 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -2,6 +2,7 @@ package fsedit; # $Id$ use diagnostics; use strict; +use vars qw(%suggestions); #-###################################################################################### #- misc imports @@ -17,19 +18,28 @@ use loopback; use log; use fs; -#-##################################################################################### -#- Globals -#-##################################################################################### -my @suggestions = ( - { mntpoint => "/boot", size => 16 << 11, type => 0x83, ratio => 1, maxsize => 30 << 11 }, - { mntpoint => "/", size => 50 << 11, type => 0x83, ratio => 1, maxsize => 300 << 11 }, - { mntpoint => "swap", size => 30 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, - { mntpoint => "/usr", size => 200 << 11, type => 0x83, ratio => 6, maxsize =>3000 << 11 }, - { mntpoint => "/home", size => 50 << 11, type => 0x83, ratio => 3 }, - { mntpoint => "/var", size => 200 << 11, type => 0x83, ratio => 1, maxsize =>1000 << 11 }, - { mntpoint => "/tmp", size => 50 << 11, type => 0x83, ratio => 3, maxsize => 500 << 11 }, +%suggestions = ( + __("simple") => [ + { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 5, maxsize =>3500 << 11 }, + { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, + { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 3 }, + ], 'with usr' => [ + { mntpoint => "/", size => 150 << 11, type => 0x83, ratio => 1, maxsize => 500 << 11 }, + { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, + { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 4, maxsize =>3000 << 11 }, + { mntpoint => "/home", size => 100 << 11, type => 0x83, ratio => 5 }, + ], __("server") => [ + { mntpoint => "/", size => 150 << 11, type => 0x83, ratio => 1, maxsize => 250 << 11 }, + { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 2, maxsize => 400 << 11 }, + { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 3, maxsize =>3000 << 11 }, + { mntpoint => "/var", size => 100 << 11, type => 0x83, ratio => 4 }, + { mntpoint => "/home", size => 100 << 11, type => 0x83, ratio => 5 }, + ], +); +my @suggestions_mntpoints = ( + "/root", "/var/ftp", "/var/www", + arch() =~ /sparc/ ? "/mnt/sunos" : "/mnt/windows", ); -my @suggestions_mntpoints = ( "/root", "/var/ftp", "/var/www", arch() =~ /sparc/ ? "/mnt/sunos" : "/mnt/windows" ); my @partitions_signatures = ( [ 0x83, 0x438, "\x53\xEF" ], @@ -155,8 +165,7 @@ sub computeSize { sub suggest_part { my ($part, $hds, $suggestions) = @_; - $suggestions ||= \@suggestions; - + $suggestions ||= $suggestions{server}; my $has_swap = grep { isSwap($_) } get_fstab(@$hds); @@ -185,7 +194,7 @@ sub suggest_part { sub suggestions_mntpoint { my ($hds) = @_; sort grep { !/swap/ && !has_mntpoint($_, $hds) } - (@suggestions_mntpoints, map { $_->{mntpoint} } @suggestions); + (@suggestions_mntpoints, map { $_->{mntpoint} } $suggestions{expert}); } #-sub partitionDrives { @@ -291,9 +300,9 @@ sub allocatePartitions($$) { } } -sub auto_allocate($;$) { +sub auto_allocate { my ($hds, $suggestions) = @_; - allocatePartitions($hds, $suggestions || \@suggestions); + allocatePartitions($hds, $suggestions || $suggestions{simple}); map { partition_table::assign_device_numbers($_) } @$hds; } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 77bcd3e0b..06299889f 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -81,41 +81,6 @@ arch() !~ /alpha/ ? ( my @install_classes = qw(normal developer server); -#-##################################################################################### -#-Default value -#-##################################################################################### -#- partition layout -my %suggestedPartitions = ( -arch() =~ /^sparc/ ? ( - normal => [ - { mntpoint => "/", size => 150 << 11, type => 0x83, ratio => 1, maxsize =>1000 << 11 }, - { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, - { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 4, maxsize =>3000 << 11 }, - { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 3 }, - ], -) : ( - normal => [ - { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 5, maxsize =>3500 << 11 }, - { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, - { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 3 }, - ], -), - developer => [ - { mntpoint => "/", size => 150 << 11, type => 0x83, ratio => 1, maxsize => 500 << 11 }, - { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, - { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 4, maxsize =>3000 << 11 }, - { mntpoint => "/home", size => 100 << 11, type => 0x83, ratio => 5 }, - ], - server => [ - { mntpoint => "/", size => 150 << 11, type => 0x83, ratio => 1, maxsize => 250 << 11 }, - { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 2, maxsize => 400 << 11 }, - { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 3, maxsize =>3000 << 11 }, - { mntpoint => "/var", size => 100 << 11, type => 0x83, ratio => 4 }, - { mntpoint => "/home", size => 100 << 11, type => 0x83, ratio => 5 }, - ], -); -$suggestedPartitions{corporate} = $suggestedPartitions{server}; - #-####################################################################################### #-$O #-the big struct which contain, well everything (globals + the interactive methods ...) @@ -129,33 +94,6 @@ $o = $::o = { #- packages => [ qw() ], partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0 }, #-, readonly => 0 }, security => 2, -#arch() =~ /^sparc/ ? ( -# partitions => [ -# { mntpoint => "/", size => 600 << 11, type => 0x83, ratio => 5, maxsize =>1000 << 11 }, -# { mntpoint => "swap", size => 128 << 11, type => 0x82, ratio => 1, maxsize => 400 << 11 }, -# { mntpoint => "/usr", size => 300 << 11, type => 0x83, ratio => 3, maxsize =>1500 << 11 }, -# { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 5 }, -# ], -#) : ( -# partitions => [ -# { mntpoint => "/boot", size => 10 << 11, type => 0x83, maxsize => 30 << 11 }, -# { mntpoint => "/", size => 300 << 11, type => 0x83, ratio => 5, maxsize => 1500 << 11 }, -# { mntpoint => "swap", size => 64 << 11, type => 0x82, ratio => 1, maxsize => 250 << 11 }, -# { mntpoint => "/home", size => 300 << 11, type => 0x83, ratio => 5 }, -# ], -#), -#- partitions => [ -#- { mntpoint => "/boot", size => 16 << 11, type => 0x83 }, -#- { mntpoint => "/", size => 256 << 11, type => 0x83 }, -#- { mntpoint => "/usr", size => 512 << 11, type => 0x83, growable => 1 }, -#- { mntpoint => "/var", size => 256 << 11, type => 0x83 }, -#- { mntpoint => "/home", size => 512 << 11, type => 0x83, growable => 1 }, -#- { mntpoint => "swap", size => 64 << 11, type => 0x82 } -#- { mntpoint => "/boot", size => 16 << 11, type => 0x83 }, -#- { mntpoint => "/", size => 300 << 11, type => 0x83 }, -#- { mntpoint => "swap", size => 64 << 11, type => 0x82 }, -#- { mntpoint => "/usr", size => 400 << 11, type => 0x83, growable => 1 }, -#- ], authentication => { md5 => 1, shadow => 1 }, lang => 'en_US', isUpgrade => 0, diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm index a627b75fa..f38159fa5 100644 --- a/perl-install/install_interactive.pm +++ b/perl-install/install_interactive.pm @@ -32,7 +32,7 @@ sub partition_with_diskdrake { do { $ok = 1; require diskdrake; - diskdrake::main($hds, $o->{raid}, interactive_gtk->new, $o->{partitions}, $nowizard); + diskdrake::main($hds, $o->{raid}, interactive_gtk->new, $nowizard); delete $o->{wizard} and return partitionWizard($o, 'nodiskdrake'); my @fstab = fsedit::get_fstab(@$hds, $o->{raid}); @@ -65,7 +65,7 @@ sub partitionWizardSolutions { my @good_hds = grep { partition_table::can_raw_add($_) } @$hds; if (fsedit::free_space(@good_hds) > $min_linux and !$readonly) { - $solutions{free_space} = [ 20, _("Use free space"), sub { fsedit::auto_allocate($hds, $o->{partitions}); 1 } ] + $solutions{free_space} = [ 20, _("Use free space"), sub { fsedit::auto_allocate($hds); 1 } ] } else { push @wizlog, _("Not enough free space to allocate new partitions") . ": " . (@good_hds ? @@ -138,7 +138,7 @@ When sure, press Ok.")) or return; partition_table::adjust_local_extended($hd, $part); partition_table::adjust_main_extended($hd); - fsedit::auto_allocate($hds, $o->{partitions}); + fsedit::auto_allocate($hds); 1; } ] if !$readonly; } else { @@ -156,7 +156,7 @@ When sure, press Ok.")) or return; $o->set_help('takeOverHdConfirm'); $o->ask_okcancel('', _("ALL existing partitions and their data will be lost on drive %s", partition_table_raw::description($hd))) or return; partition_table_raw::zero_MBR($hd); - fsedit::auto_allocate($hds, $o->{partitions}); + fsedit::auto_allocate($hds); 1; } ]; } |