summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps_stdio.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-07-29 15:18:54 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-07-29 15:18:54 +0000
commit88a07c82cece62903ae68e1e2c482d810bbf8560 (patch)
tree5eee08b842d20f111fc82bba2e42425e253e8a50 /perl-install/install_steps_stdio.pm
parent5dc2835bfbf1f53ad51ba540f4423c22cc94b26c (diff)
downloaddrakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar.gz
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar.bz2
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.tar.xz
drakx-88a07c82cece62903ae68e1e2c482d810bbf8560.zip
no_comment
Diffstat (limited to 'perl-install/install_steps_stdio.pm')
-rw-r--r--perl-install/install_steps_stdio.pm148
1 files changed, 11 insertions, 137 deletions
diff --git a/perl-install/install_steps_stdio.pm b/perl-install/install_steps_stdio.pm
index 22e171c22..908d14080 100644
--- a/perl-install/install_steps_stdio.pm
+++ b/perl-install/install_steps_stdio.pm
@@ -4,78 +4,27 @@ use diagnostics;
use strict;
use vars qw(@ISA);
-@ISA = qw(install_steps);
+@ISA = qw(install_steps_interactive interactive_stdio);
use common qw(:common);
-use partition_table qw(:types);
use devices;
use run_program;
-use install_steps;
+use interactive_stdio;
+use install_steps_interactive;
use install_any;
-use diskdrake;
-use lang;
use log;
1;
sub enteringStep($$$) {
my ($o, $step) = @_;
- print "Starting step `$o->{steps}->{$step}->{text}'\n";
+ print _("Starting step `%s'\n", $o->{steps}->{$step}->{text});
}
sub leavingStep {
my ($o) = @_;
print "--------\n";
}
-sub chooseLanguage($) {
- my $lang = lang::text2lang(ask_from_list("Language", # no use translating this
- "Which language do you want?",
- [ lang::list() ]));
- run_program::run('xmodmap', "/usr/bin/$lang.map");
- $lang;
-}
-
-sub selectInstallOrUpgrade($) {
- ask_yesorno('Install/Upgrade', 'Do you want to upgrade an already installed Mandrake?');
-}
-
-sub selectInstallClass($@) {
- my ($o, @classes) = @_;
- my $c = ask_from_list(_("Install Class"),
- _("What type of user will you have?"),
- [ map { translate($_) } @classes ]);
- untranslate($c, @classes);
-}
-
-sub rebootNeeded($) {
- my ($o) = @_;
- ask_warn('', "You need to reboot for the partition table modifications to take place");
- $o->SUPER::rebootNeeded;
-}
-
-sub choosePartitionsToFormat($$) {
- my ($o, $fstab) = @_;
- my @l = grep { $_->{mntpoint} && (isExt2($_) || isSwap($_)) } @$fstab;
- my @r = ask_many_from_list('', "Choose the partitions you want to format",
- [ map { $_->{mntpoint} } @l ],
- [ map { $_->{notFormatted} } @l ]);
- for (my $i = 0; $i < @l; $i++) {
- $l[$i]->{toFormat} = $r[$i];
- }
-}
-
-sub choosePackages($$$) {
- my ($o, $packages, $compss) = @_;
- my @r = ask_many_from_list('',
- "Choose the packages you want to install",
- [ map { $_->{name} } @$compss ],
- [ map { $_->{selected} } @$compss ]);
-
- for (my $i = 0; $i < @$compss; $i++) {
- $compss->[$i]->{selected} = $r[$i];
- }
-}
-
sub installPackages {
my $o = shift;
@@ -97,9 +46,9 @@ sub setRootPassword($) {
my (%w);
do {
$w{password} and print "You must enter the same password, please try again\n";
- print "Password: "; $w{password} = readln();
+ print "Password: "; $w{password} = $o->readln();
print "Password (again for confirmation): ";
- } until ($w{password} eq readln());
+ } until ($w{password} eq $o->readln());
$o->{default}->{rootPassword} = $w{password};
$o->SUPER::setRootPassword;
@@ -109,91 +58,16 @@ sub addUser($) {
my ($o) = @_;
my %w;
print "\nCreating a normal user account:\n";
- print "Name: "; $w{name} = readln() or return;
+ print "Name: "; $w{name} = $o->readln() or return;
do {
$w{password} and print "You must enter the same password, please try again\n";
- print "Password: "; $w{password} = readln();
+ print "Password: "; $w{password} = $o->readln();
print "Password (again for confirmation): ";
- } until ($w{password} eq readln());
- print "Real name: "; $w{realname} = readln();
+ } until ($w{password} eq $o->readln());
+ print "Real name: "; $w{realname} = $o->readln();
- $w{shell} = ask_from_list('', 'Shell', $o->{default}->{shells});
+ $w{shell} = $o->ask_from_list('', 'Shell', $o->{default}->{shells}, "/bin/bash");
$o->{default}->{user} = { map { $_ => $w{$_}->get_text } qw(name password realname shell) };
$o->SUPER::addUser;
}
-
-sub createBootdisk($) {
- my ($o) = @_;
-
- $o->SUPER::createBootdisk if
- $o->{default}->{mkbootdisk} = ask_yesorno('',
-"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?");
-}
-
-sub readln {
- my $l = <STDIN>;
- chomp $l;
- $l;
-}
-
-sub ask_warn {
- my ($title, @msgs) = @_;
- warn(@msgs);
-}
-
-sub ask_yesorno {
- my ($title, @msgs) = @_;
- print join("\n", @_);
- print " (yes/No) "; readln() =~ /y/i;
-
-}
-
-sub check_it {
- my ($i, $n) = @_;
- $i =~ /^\s*\d+\s*$/ && 1 <= $i && $i <= $n
-}
-
-sub ask_from_list {
- my ($title, @msgs) = @_;
- my $list = pop @msgs;
- print map { "$_\n" } @msgs;
- my $n = 0; foreach (@$list) { $n++; print "$n: $_\n"; }
- my $i;
- do {
- defined $i and print "Bad choice, try again\n";
- print "Your choice? (1/$n) ";
- $i = readln();
- } until (check_it($i, $n));
- $list->[$i - 1];
-}
-
-sub ask_many_from_list {
- my ($title, @msgs) = @_;
- my $default = pop @msgs;
- my $list = pop @msgs;
- my @defaults;
- print map { "$_\n" } @msgs;
- my $n = 0; foreach (@$list) {
- $n++;
- print "$n: $_\n";
- push @defaults, $n if $default->[$n - 1];
- }
- my $i;
- TRY_AGAIN:
- defined $i and print "Bad choice, try again\n";
- print "Your choice? (default ", join(',', @defaults), " enter `none' for none) ";
- $i = readln();
- my @t = split ',', $i;
- foreach (@t) { check_it($_, $n) or goto TRY_AGAIN }
-
- my @rr = (0) x @$list;
- $rr[$_ - 1] = 1 foreach @t;
- @rr;
-}
-