diff options
Diffstat (limited to 'perl-install/install_steps_interactive.pm')
-rw-r--r-- | perl-install/install_steps_interactive.pm | 202 |
1 files changed, 107 insertions, 95 deletions
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index a33768e21..11f782d8f 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -7,6 +7,9 @@ use vars qw(@ISA); @ISA = qw(install_steps); +#-###################################################################################### +#- misc imports +#-###################################################################################### use common qw(:common); use partition_table qw(:types); use install_steps; @@ -22,55 +25,75 @@ use log; use printer; 1; +#-###################################################################################### +#- misc functions +#-###################################################################################### sub errorInStep($$) { my ($o, $err) = @_; $o->ask_warn(_("Error"), [ _("An error occurred"), $err ]); } -sub chooseLanguage($) { +#-###################################################################################### +#- Steps Functions +#-###################################################################################### +#------------------------------------------------------------------------------ +sub selectLanguage($) { my ($o) = @_; - lang::text2lang($o->ask_from_list("Language", - __("Which language do you want?"), # the translation may be used for the help - [ lang::list() ], - lang::lang2text($o->default("lang")))); + $o->{lang} = + lang::text2lang($o->ask_from_list("Language", + __("Which language do you want?"), + # the translation may be used for the help + [ lang::list() ], + lang::lang2text($o->{lang}))); + install_steps::selectLanguage($o); } - -sub chooseKeyboard($) { +#------------------------------------------------------------------------------ +sub selectKeyboard($) { my ($o) = @_; - keyboard::text2keyboard($o->ask_from_list_("Keyboard", - _("Which keyboard do you have?"), - [ keyboard::list() ], - keyboard::keyboard2text($o->default("keyboard")))); + $o->{keyboard} = + keyboard::text2keyboard($o->ask_from_list_("Keyboard", + _("Which keyboard do you have?"), + [ keyboard::list() ], + keyboard::keyboard2text($o->{keyboard}))); + install_steps::selectKeyboard($o); } - -sub selectInstallOrUpgrade($) { +#------------------------------------------------------------------------------ +sub selectPath($) { my ($o) = @_; - $o->ask_from_list_(_("Install/Upgrade"), - _("Is this an install or an upgrade?"), - [ __("Install"), __("Upgrade") ], - $o->default("isUpgrade") ? "Upgrade" : "Install") eq "Upgrade"; -} + $o->{isUpgrade} = + $o->ask_from_list_(_("Install/Upgrade"), + _("Is this an install or an upgrade?"), + [ __("Install"), __("Upgrade") ], + $o->{isUpgrade} ? "Upgrade" : "Install") eq "Upgrade"; + install_steps::selectPath($o); +} +#------------------------------------------------------------------------------ sub selectInstallClass($@) { my ($o, @classes) = @_; - $o->ask_from_list_(_("Install Class"), - _("What type of user will you have?"), - [ @classes ], $o->default("installClass")); + $o->{installClass} = + $o->ask_from_list_(_("Install Class"), + _("What type of user will you have?"), + [ @classes ], $o->{installClass}); + install_steps::selectInstallClass($o); } +#------------------------------------------------------------------------------ sub setupSCSI { setup_thiskind($_[0], 'scsi', $_[1]) } - +#------------------------------------------------------------------------------ sub rebootNeeded($) { my ($o) = @_; $o->ask_warn('', _("You need to reboot for the partition table modifications to take place")); - $o->SUPER::rebootNeeded; + + install_steps::rebootNeeded($o); } +#------------------------------------------------------------------------------ sub choosePartitionsToFormat($$) { my ($o, $fstab) = @_; - $o->SUPER::choosePartitionsToFormat($fstab); + install_steps::choosePartitionsToFormat($o, $fstab); my @l = grep { $_->{mntpoint} && isExt2($_) || isSwap($_) } @$fstab; my @r = $o->ask_many_from_list_ref('', _("Choose the partitions you want to format"), @@ -124,26 +147,25 @@ sub configureNetwork($) { $o->configureNetworkIntf($intf); $last = $intf; } -# { -# my $wait = $o->wait_message(_("Hostname"), _("Determining host name and domain...")); -# network::guessHostname($o->{prefix}, $o->{netc}, $o->{intf}); -# } + # { + # my $wait = $o->wait_message(_("Hostname"), _("Determining host name and domain...")); + # network::guessHostname($o->{prefix}, $o->{netc}, $o->{intf}); + # } $o->configureNetworkNet($o->{netc} ||= {}, @l); } - $o->SUPER::configureNetwork; + install_steps::configureNetwork($o); } sub timeConfig { my ($o, $f) = @_; - add2hash($o->{timezone} ||= {}, $o->default("timezone")); $o->{timezone}{GMT} = $o->ask_yesorno('', _("Is your hardware clock set to GMT?"), $o->{timezone}{GMT}); $o->{timezone}{timezone} = $o->ask_from_list('', _("In which timezone are you"), [ install_any::getTimeZones() ], $o->{timezone}{timezone}); - $o->SUPER::timeConfig($f); + install_steps::timeConfig($o,$f); } sub printerConfig($) { - my($o) = @_; + my ($o) = @_; $o->{printer}{want} = $o->ask_yesorno(_("Printer"), _("Would you like to configure a printer?"), @@ -151,13 +173,6 @@ sub printerConfig($) { return if !$o->{printer}{want}; $o->{printer}{complete} = 0; - #default value - foreach (keys %printer::fields) { - foreach (@{$printer::fields{$_}}) { - $o->{printer}{$_} ||= $o->{default}{printer}{$_}; - } - - } if ($::expert) { #std info #Don't wait, if the user enter something, you must remember it @@ -188,7 +203,7 @@ sub printerConfig($) { my @port = (); foreach ("lp0", "lp1", "lp2") { local *LP; - push @port, "/dev/$_" if open LP, ">/dev/$_"; + push @port, "/dev/$_" if open LP, ">/dev/$_" } eval { modules::unload("lp") }; @@ -196,9 +211,7 @@ sub printerConfig($) { (note that /dev/lp0 is equivalent to LPT1:)?\n"); $string .= _("I detect :"); $string .= join(", ", @port); - $o->{printer}{DEVICE} ||= $port[0]; - $o->{printer}{DEVICE} ||= $o->{default}{printer}{DEVICE}; - + $o->{printer}{DEVICE} = $port[0] if $port[0]; return if !$o->ask_from_entries_ref(_("Local Printer Device"), $string, @@ -209,46 +222,48 @@ sub printerConfig($) { } elsif ($o->{printer}{TYPE} eq "REMOTE") { return if !$o->ask_from_entries_ref(_("Remote lpd Printer Options"), - _("To use a remote lpd print queue, you need to supply + _("To use a remote lpd print queue, you need to supply the hostname of the printer server and the queue name on that server which jobs should be placed in."), - [_("Remote hostname:"), _("Remote queue:")], - [\$o->{printer}{REMOTEHOST}, \$o->{printer}{REMOTEQUEUE}], - ); + [_("Remote hostname:"), _("Remote queue:")], + [\$o->{printer}{REMOTEHOST}, \$o->{printer}{REMOTEQUEUE}], + ); } elsif ($o->{printer}{TYPE} eq "SMB") { return if !$o->ask_from_entries_ref(_("SMB/Windows 95/NT Printer Options"), - _("To print to a SMB printer, you need to provide the + _("To print to a SMB printer, you need to provide the SMB host name (this is not always the same as the machines TCP/IP hostname) and possibly the IP address of the print server, as well as the share name for the printer you wish to access and any applicable user name, password, and workgroup information."), - [_("SMB server host:"), _("SMB server IP:"), - _("Share name:"), _("User name:"), _("Password:"), - _("Workgroup:")], - [\$o->{printer}{SMBHOST}, \$o->{printer}{SMBHOSTIP}, - \$o->{printer}{SMBSHARE}, \$o->{printer}{SMBUSER}, - \$o->{printer}{SMBPASSWD}, \$o->{printer}{SMBWORKGROUP} - ] - ); - } elsif ($o->{printer}{TYPE} eq "NCP") { + [_("SMB server host:"), _("SMB server IP:"), + _("Share name:"), _("User name:"), _("Password:"), + _("Workgroup:")], + [\$o->{printer}{SMBHOST}, \$o->{printer}{SMBHOSTIP}, + \$o->{printer}{SMBSHARE}, \$o->{printer}{SMBUSER}, + \$o->{printer}{SMBPASSWD}, \$o->{printer}{SMBWORKGROUP} + ] + ); + } else {#($o->{printer}{TYPE} eq "NCP") { return if !$o->ask_from_entries_ref(_("NetWare Printer Options"), - _("To print to a NetWare printer, you need to provide the + _("To print to a NetWare printer, you need to provide the NetWare print server name (this is not always the same as the machines TCP/IP hostname) as well as the print queue name for the printer you wish to access and any applicable user name and password."), - [_("Printer Server:"), _("Print Queue Name:"), - _("User name:"), _("Password:")], - [\$o->{printer}{NCPHOST}, \$o->{printer}{NCPQUEUE}, - \$o->{printer}{NCPUSER}, \$o->{printer}{NCPPASSWD}], - ); + [_("Printer Server:"), _("Print Queue Name:"), + _("User name:"), _("Password:")], + [\$o->{printer}{NCPHOST}, \$o->{printer}{NCPQUEUE}, + \$o->{printer}{NCPUSER}, \$o->{printer}{NCPPASSWD}], + ); } unless (($::testing)) { printer::set_prefix($o->{prefix}); pkgs::select($o->{packages}, $o->{packages}{'rhs-printfilters'}); $o->installPackages($o->{packages}); + } + printer::read_printer_db(); my @entries_db_short = sort keys %printer::thedb; my @entry_db_description = map { $printer::thedb{$_}{DESCR} } @entries_db_short; @@ -280,23 +295,20 @@ wish to access and any applicable user name and password."), my @res = map { "${$_}{XDPI}x${$_}{YDPI}" } @list_res; if (@list_res) { $o->{printer}{RESOLUTION} = $o->ask_from_list_(_("Resolution"), - _("Resolution"), - \@res, - $o->{printer}{RESOLUTION}, - ); + _("Resolution"), + \@res, + $o->{printer}{RESOLUTION}, + ); } else { $o->{printer}{RESOLUTION} = "Default"; } - - #Fix ster stepping - # MAJOR HACK - # if the printer is an HP, let's do stairstep correction $o->{printer}{CRLF} = $db_entry{DESCR} =~ /HP/; $o->{printer}{CRLF}= $o->ask_yesorno(_("CRLF"), _("Fix stair-stepping of text?"), $o->{printer}{CRLF}); + #color_depth my @list_col = @{$db_entry{BITSPERPIXEL}}; my @col = map { "$_->{DEPTH} $_->{DESCR}" } @list_col; @@ -312,7 +324,7 @@ wish to access and any applicable user name and password."), _("You may now configure the uniprint options for this printer."), \@col, $depth_to_col{$o->{printer}{BITSPERPIXEL}}, - )}; + )}; } else { $o->{printer}{BITSPERPIXEL} = @@ -321,13 +333,14 @@ wish to access and any applicable user name and password."), _("You may now configure the color options for this printer."), \@col, $depth_to_col{$o->{printer}{BITSPERPIXEL}}, - )}; + )}; } } else { - $o->{default}{printer}{BITSPERPIXEL} = "Default"; + $o->{printer}{BITSPERPIXEL} = "Default"; } $o->{printer}{complete} = 1; - $o->SUPER::printerConfig; + + install_steps::printerConfig($o); } @@ -337,25 +350,24 @@ sub createBootdisk { if ($first_time || @l == 1) { $o->ask_yesorno('', - _("A custom bootdisk provides a way of booting into your Linux system without + _("A custom bootdisk provides a way of booting into your Linux system without depending on the normal bootloader. This is useful if you don't want to install lilo on your system, or another operating system removes lilo, or lilo doesn't work with your hardware configuration. A custom bootdisk can also be used with the Mandrake rescue image, making it much easier to recover from severe system -failures. Would you like to create a bootdisk for your system?"), !$o->default("mkbootdisk")) or return; +failures. Would you like to create a bootdisk for your system?"), !$o->{mkbootdisk}) or return; - $o->{mkbootdisk} = $o->default("mkbootdisk") || 1; } else { @l or die _("Sorry, no floppy drive available"); $o->{mkbootdisk} = $o->ask_from_list('', -_("Choose the floppy drive you want to use to make the bootdisk"), - \@l, $o->default("mkbootdisk")); + _("Choose the floppy drive you want to use to make the bootdisk"), + \@l, $o->{mkbootdisk}); } $o->ask_warn('', _("Insert a floppy in drive %s", $o->{mkbootdisk})); my $w = $o->wait_message('', _("Creating bootdisk")); - $o->SUPER::createBootdisk; + install_steps::createBootdisk($o); } sub setupBootloader($) { @@ -366,15 +378,15 @@ sub setupBootloader($) { $o->ask_from_list_(_("Lilo Installation"), _("Where do you want to install the bootloader?"), \@l, - $l[!$o->default("bootloader")->{onmbr}] + $l[!$o->{bootloader}{onmbr}] ) eq $l[0]; - $o->SUPER::setupBootloader; + install_steps::setupBootloader($o); } sub exitInstall { my ($o) = @_; $o->ask_warn('', -_("Congratulations, installation is complete. + _("Congratulations, installation is complete. Remove the boot media and press return to reboot. For information on fixes which are available for this release of Linux Mandrake, consult the Errata available from http://www.linux-mandrake.com/. @@ -391,19 +403,19 @@ sub loadModule { [ modules::text_of_type($type) ]) or return; my $m = modules::text2driver($l); if ($o->ask_from_list('', -_("In some cases, the %s driver needs to have extra information to work + _("In some cases, the %s driver needs to have extra information to work properly, although it normally works fine without. Would you like to specify extra options for it or allow the driver to probe your machine for the information it needs? Occasionally, probing will hang a computer, but it should not cause any damage.", $l), [ __("Autoprobe"), __("Specify options") ], "Autoprobe") ne "Autoprobe") { @options = split ' ', - $o->ask_from_entry('', -_("Here must give the different options for the module %s. + $o->ask_from_entry('', + _("Here must give the different options for the module %s. Options are in format ``name=value name2=value2 ...''. For example you can have ``io=0x300 irq=7''", $l), - _("Module options:"), - ); + _("Module options:"), + ); } modules::load($m, $type, @options); $l, $m; @@ -413,11 +425,11 @@ sub load_thiskind { my ($o, $type) = @_; my $w; modules::load_thiskind($type, sub { - $w = $o->wait_message('', - [ _("Installing driver for %s card %s", $type, $_->[0]), - $o->{installClass} ne "beginner" ? _("(module %s)", $_->[1]) : () - ]); - }); + $w = $o->wait_message('', + [ _("Installing driver for %s card %s", $type, $_->[0]), + $o->{installClass} ne "beginner" ? _("(module %s)", $_->[1]) : () + ]); + }); } sub setup_thiskind { @@ -430,7 +442,7 @@ sub setup_thiskind { $o->ask_yesorno('', [ _("Found %s %s interfaces", join(", ", map { $_->[0] } @l), $type), _("Do you have another one?") ], "No") : - $o->ask_yesorno('', _("Do you have an %s interface?", $type), "No") or return; + $o->ask_yesorno('', _("Do you have an %s interface?", $type), "No") or return; push @l, [ $o->loadModule($type) ]; } |