diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/common.pm | 2 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 7 | ||||
-rw-r--r-- | perl-install/install2.pm | 23 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 13 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 13 | ||||
-rw-r--r-- | perl-install/timezone.pm | 16 |
6 files changed, 50 insertions, 24 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm index 7bd373162..e47df42d4 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -7,7 +7,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int @ISA = qw(Exporter); %EXPORT_TAGS = ( common => [ qw(__ min max sqr sum sign product bool listlength bool2text to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX) ], - functional => [ qw(fold_left map_index map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ], + functional => [ qw(fold_left compose map_index map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ], file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ], system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_ getVarsFromSh setVarsInSh) ], constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE) ], diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index bf7574f5e..8aa73fc2e 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -67,6 +67,13 @@ sub get_fstab(@) { map { partition_table::get_normal_parts($_) } @_; } +sub get_root($) { + my ($fstab) = @_; + $_->{mntpoint} eq "/" and return $_ foreach @$fstab; + undef; +} +sub get_root_ { get_root([ get_fstab(@{$_[0]}) ]) } + sub suggest_part($$$;$) { my ($hd, $part, $hds, $suggestions) = @_; $suggestions ||= \@suggestions; diff --git a/perl-install/install2.pm b/perl-install/install2.pm index d308fe8e5..c0a4e2178 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -62,6 +62,7 @@ for (my $i = 0; $i < @installSteps; $i += 2) { my %h; @h{@installStepsFields} = @{ $installSteps[$i + 1] }; $h{help} = $help::steps{$installSteps[$i]} || __("Help"); $h{next} = $installSteps[$i + 2]; + $h{entered} = 0; $h{onError} = $installSteps[$i + 2 * $h{onError}]; $installSteps{ $installSteps[$i] } = \%h; push @orderedInstallSteps, $installSteps[$i]; @@ -233,6 +234,7 @@ sub selectInstallClass { $::expert = $o->{installClass} eq "expert"; $::beginner = $o->{installClass} eq "beginner"; $o->{partitions} ||= $suggestedPartitions{$o->{installClass}}; + $o->{partitioning}{auto_allocate} = 1; $o->setPackages(\@install_classes) if $o->{steps}{choosePackages}{entered} >= 1; } @@ -266,7 +268,12 @@ I'll try to go on blanking bad partitions")); } eval { fsedit::auto_allocate($o->{hds}, $o->{partitions}) } if $o->{partitioning}{auto_allocate}; - $o->doPartitionDisks($o->{hds}); + + if ($o->{partitioning}{auto_allocated} = ($::beginner && fsedit::get_root_($o->{hds}) && $_[1] == 1)) { + install_steps::doPartitionDisks($o, $o->{hds}); + } else { + $o->doPartitionDisks($o->{hds}); + } unless ($::testing) { $o->rebootNeeded foreach grep { $_->{rebootNeeded} } @{$o->{hds}}; @@ -274,14 +281,16 @@ I'll try to go on blanking bad partitions")); $o->{fstab} = [ fsedit::get_fstab(@{$o->{hds}}) ]; - my $root_fs; map { $_->{mntpoint} eq '/' and $root_fs = $_ } @{$o->{fstab}}; - $root_fs or die _("partitioning failed: no root filesystem"); + fsedit::get_root($o->{fstab}) or die _("partitioning failed: no root filesystem"); } sub formatPartitions { - $o->choosePartitionsToFormat($o->{fstab}); - + if ($o->{partitioning}{auto_allocated}) { #- if all was auto_allocated, no need to ask, go on! + install_steps::choosePartitionsToFormat($o, $o->{fstab}); + } else { + $o->choosePartitionsToFormat($o->{fstab}); + } unless ($::testing) { $o->formatPartitions(@{$o->{fstab}}); fs::mount_all([ grep { isExt2($_) || isSwap($_) } @{$o->{fstab}} ], $o->{prefix}); @@ -474,6 +483,10 @@ sub main { last if $o->{step} eq 'exitInstall'; } + + fs::write($o->{prefix}, $o->{fstab}); + modules::write_conf("$o->{prefix}/etc/conf.modules", 'append'); + killCardServices(); log::l("installation complete, leaving"); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index c298c2c9f..f779268ca 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -10,6 +10,7 @@ use common qw(:file :system :common); use install_any qw(:all); use partition_table qw(:types); use detect_devices; +use timezone; use modules; use run_program; use lilo; @@ -100,7 +101,7 @@ sub setupSCSI { modules::load_thiskind('scsi') } sub doPartitionDisks($$) { my ($o, $hds) = @_; return if $::testing; - partition_table::write($_) foreach $hds; + partition_table::write($_) foreach @$hds; } #------------------------------------------------------------------------------ @@ -194,15 +195,7 @@ sub pcmciaConfig($) { #------------------------------------------------------------------------------ sub timeConfig { my ($o, $f) = @_; - my $t = $o->{timezone}; - - eval { commands::cp("-f", "/usr/share/zoneinfo/$t->{timezone}", "/etc/localtime") }; - $@ and log::l("installing /etc/localtime failed"); - setVarsInSh($f, { - ZONE => $t->{timezone}, - GMT => bool2text($t->{GMT}), - ARC => "false", - }); + timezone::write($o->{prefix}, $o->{timezone}, $f); } #------------------------------------------------------------------------------ diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index f57a0f152..59b92f90b 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -118,13 +118,12 @@ sub rebootNeeded($) { sub choosePartitionsToFormat($$) { my ($o, $fstab) = @_; - install_steps::choosePartitionsToFormat($o, $fstab); + $o->SUPER::choosePartitionsToFormat($fstab); my @l = grep { $_->{mntpoint} && isExt2($_) || isSwap($_) && !$::beginner } @$fstab; - my @r = $o->ask_many_from_list_ref('', _("Choose the partitions you want to format"), - [ map { $_->{mntpoint} || type2name($_->{type}) . " ($_->{device})" } @l ], - [ map { \$_->{toFormat} } @l ]); - defined @r or die "cancel"; + $o->ask_many_from_list_ref('', _("Choose the partitions you want to format"), + [ map { $_->{mntpoint} || type2name($_->{type}) . " ($_->{device})" } @l ], + [ map { \$_->{toFormat} } @l ]) or die "cancel"; } sub formatPartitions { @@ -543,7 +542,7 @@ sub setupBootloader($) { $l[!$o->{bootloader}{onmbr}] ) eq $l[0] unless $::beginner && $o->{bootloader}{onmbr}; - lilo::proposition($o->{hds}, $o->{fstab}, $o->{bootloader}); + lilo::suggest($o->{hds}, $o->{fstab}, $o->{bootloader}); unless ($::beginner) { my @entries = grep { $_->{liloLabel} } @{$o->{fstab}}; @@ -647,7 +646,7 @@ sub setup_thiskind { my $opt = [ __("Yes"), __("No") ]; push @$opt, __("See hardware info") if $::expert; my $r = "Yes"; - $r = $o->ask_from_list_('', $msg, $opt) unless $at_least_one && @l == 0; + $r = $o->ask_from_list_('', $msg, $opt, "No") unless $at_least_one && @l == 0; if ($r eq "No") { return } elsif ($r eq "Yes") { my @r = $o->loadModule($type) or return; diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index b6f9cb364..6330cb325 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -3,7 +3,9 @@ package timezone; use diagnostics; use strict; -use common; +use common qw(:common :system); +use commands; +use log; sub getTimeZones { @@ -15,6 +17,18 @@ sub getTimeZones { @l; } +sub write($$$) { + my ($prefix, $t, $f) = @_; + + eval { commands::cp("-f", "$prefix/usr/share/zoneinfo/$t->{timezone}", "$prefix/etc/localtime") }; + $@ and log::l("installing /etc/localtime failed"); + setVarsInSh($f, { + ZONE => $t->{timezone}, + GMT => bool2text($t->{GMT}), + ARC => "false", + }); +} + my %l2t = ( 'Danish (Denmark)' => 'Europe/Copenhagen', 'English (USA)' => 'America/New_York', |