summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorpad <pad@mandriva.com>1999-09-03 13:44:30 +0000
committerpad <pad@mandriva.com>1999-09-03 13:44:30 +0000
commit59a71876a17e616e3706c80cddf3e74f34bbcf67 (patch)
treee52f9979a37b9e3256a5f764d8c9f4cc85b9464f /perl-install
parent874f08a1316d73d6f09f0ca2df235dac495a387b (diff)
downloaddrakx-backup-do-not-use-59a71876a17e616e3706c80cddf3e74f34bbcf67.tar
drakx-backup-do-not-use-59a71876a17e616e3706c80cddf3e74f34bbcf67.tar.gz
drakx-backup-do-not-use-59a71876a17e616e3706c80cddf3e74f34bbcf67.tar.bz2
drakx-backup-do-not-use-59a71876a17e616e3706c80cddf3e74f34bbcf67.tar.xz
drakx-backup-do-not-use-59a71876a17e616e3706c80cddf3e74f34bbcf67.zip
pad stuff
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/common.pm34
-rw-r--r--perl-install/install2.pm138
-rw-r--r--perl-install/install_any.pm4
-rw-r--r--perl-install/install_steps.pm19
-rw-r--r--perl-install/install_steps_interactive.pm66
-rw-r--r--perl-install/interactive.pm23
-rw-r--r--perl-install/interactive_gtk.pm31
-rw-r--r--perl-install/keyboard.pm3
-rw-r--r--perl-install/lang.pm9
-rw-r--r--perl-install/log.pm3
-rw-r--r--perl-install/modules.pm42
11 files changed, 289 insertions, 83 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 329dceaae..05091d546 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -6,18 +6,18 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- common => [ qw(__ min max sum sign product bool bool2text ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ],
- functional => [ qw(fold_left map_index 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) ],
+ common => [ qw(__ min max sum sign product bool bool2text ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ],
+ functional => [ qw(fold_left 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) ],
);
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
-$printable_chars = "\x20-\x7E";
-$sizeof_int = psizeof("i");
-$bitof_int = $sizeof_int * 8;
-$SECTORSIZE = 512;
+$printable_chars = "\x20-\x7E";
+$sizeof_int = psizeof("i");
+$bitof_int = $sizeof_int * 8;
+$SECTORSIZE = 512;
1;
@@ -84,6 +84,20 @@ sub map_index(&@) {
@l;
}
+#pseudo-array-hash :)
+sub map_tab_hash(&$@) {
+ my ($f, $fields, @tab_hash) = @_;
+ my %hash;
+ my $key = { map_index {($_, $::i + 1)} @{$fields} };
+
+ for (my $i = 0; $i < @tab_hash; $i += 2) {
+ my $h = [$key, @{$tab_hash[$i + 1]}];
+ &$f($i, $h) if $f;
+ $hash{ $tab_hash[$i] } = $h;
+ }
+ %hash;
+}
+
sub smapn {
my $f = shift;
my $n = shift;
@@ -247,3 +261,5 @@ sub setVarsInSh {
open F, "> $_[0]" or die "cannot create config file $file";
$l->{$_} and print F "$_=$l->{$_}\n" foreach @fields;
}
+
+
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 02c4dd38b..4ca363782 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -11,15 +11,17 @@ use network;
use keyboard;
use fs;
use fsedit;
-use install_steps_graphical;
use modules;
use partition_table qw(:types);
use detect_devices;
use pkgs;
use smp;
use lang;
+use printer;
use run_program;
+use install_steps_graphical;
+use Data::Dumper;
my %stepsHelp = (
@@ -160,29 +162,30 @@ exitInstall =>
);
-my @installStepsFields = qw(text redoable onError needs);
+my @installStepsFields = qw(text redoable onError needs entered reachable toBeDone help next done);
my @installSteps = (
- selectLanguage => [ __("Choose your language"), 1, 1 ],
- selectPath => [ __("Choose install or upgrade"), 0, 0 ],
- selectInstallClass => [ __("Select installation class"), 1, 1, "selectPath" ],
- selectKeyboard => [ __("Choose your keyboard"), 1, 1 ],
- setupSCSI => [ __("Setup SCSI"), 1, 0 ],
- partitionDisks => [ __("Setup filesystems"), 1, 0 ],
- formatPartitions => [ __("Format partitions"), 1, -1, "partitionDisks" ],
- choosePackages => [ __("Choose packages to install"), 1, 1, "selectInstallClass" ],
- doInstallStep => [ __("Install system"), 1, -1, ["formatPartitions", "selectPath"] ],
- configureMouse => [ __("Configure mouse"), 1, 1, "formatPartitions" ],
- configureNetwork => [ __("Configure networking"), 1, 1, "formatPartitions" ],
- configureTimezone => [ __("Configure timezone"), 1, 1, "doInstallStep" ],
-# configureServices => [ __("Configure services"), 0, 0 ],
- configurePrinter => [ __("Configure printer"), 0, 0 ],
- setRootPassword => [ __("Set root password"), 1, 1, "formatPartitions" ],
- addUser => [ __("Add a user"), 1, 1, "doInstallStep" ],
- createBootdisk => [ __("Create bootdisk"), 1, 0, "doInstallStep" ],
- setupBootloader => [ __("Install bootloader"), 1, 1, "doInstallStep" ],
- configureX => [ __("Configure X"), 1, 0, "doInstallStep" ],
- exitInstall => [ __("Exit install"), 0, 0, "alldone" ],
+ selectLanguage => [ __("Choose your language"), 1, 1 ],
+ selectPath => [ __("Choose install or upgrade"), 0, 0 ],
+ selectInstallClass => [ __("Select installation class"), 1, 1, "selectPath" ],
+ selectKeyboard => [ __("Choose your keyboard"), 1, 1 ],
+ setupSCSI => [ __("Setup SCSI"), 1, 0 ],
+ partitionDisks => [ __("Setup filesystems"), 1, 0 ],
+ formatPartitions => [ __("Format partitions"), 1, -1, "partitionDisks" ],
+ choosePackages => [ __("Choose packages to install"), 1, 1, "selectInstallClass" ],
+ doInstallStep => [ __("Install system"), 1, -1, ["formatPartitions", "selectPath"] ],
+ configureMouse => [ __("Configure mouse"), 1, 1, "formatPartitions" ],
+ configureNetwork => [ __("Configure networking"), 1, 1, "formatPartitions" ],
+ configureTimezone => [ __("Configure timezone"), 1, 1, "doInstallStep" ],
+# configureServices => [ __("Configure services"), 0, 0 ],
+ configurePrinter => [ __("Configure printer"), 1, 0, ],
+ setRootPassword => [ __("Set root password"), 1, 1, "formatPartitions" ],
+ addUser => [ __("Add a user"), 1, 1, "doInstallStep" ],
+ createBootdisk => [ __("Create bootdisk"), 1, 0, "doInstallStep" ],
+ setupBootloader => [ __("Install bootloader"), 1, 1, "doInstallStep" ],
+ configureX => [ __("Configure X"), 1, 0, "doInstallStep" ],
+ exitInstall => [ __("Exit install"), 0, 0, "alldone" ],
);
+
my (%installSteps, %upgradeSteps, @orderedInstallSteps, @orderedUpgradeSteps);
for (my $i = 0; $i < @installSteps; $i += 2) {
my %h; @h{@installStepsFields} = @{ $installSteps[$i + 1] };
@@ -192,12 +195,27 @@ for (my $i = 0; $i < @installSteps; $i += 2) {
$installSteps{ $installSteps[$i] } = \%h;
push @orderedInstallSteps, $installSteps[$i];
}
+
+#TOSEE bug avec
+#%installSteps =
+# map_tab_hash {
+# my ($i, $h) = @_;
+# $h->{help} = $stepsHelp{$installSteps[$i]} || __("Help");
+# $h->{next} = $installSteps[$i + 2];
+# $h->{onError} = $installSteps[$i + 2 * $h->{onError}];
+## $h->{toBeDone} = []; SEMBLE FIXE les PBS
+## $h->{entered} = 0;
+# push @orderedInstallSteps, $installSteps[$i];
+# } \@installStepsFields, @installSteps;
+#print Dumper(\%installSteps);
+
$installSteps{first} = $installSteps[0];
my @install_classes = (__("beginner"), __("developer"), __("server"), __("expert"));
# partition layout for a server
+#NOT YET USED
my @serverPartitioning = (
{ mntpoint => "/boot", size => 16 << 11, type => 0x83 },
{ mntpoint => "/", size => 256 << 11, type => 0x83 },
@@ -207,14 +225,12 @@ my @serverPartitioning = (
{ mntpoint => "swap", size => 64 << 11, type => 0x82 }
);
+#all the fields can be also present in $o, (in that case it overides)
my $default = {
-# display => "192.168.1.9:0",
-
bootloader => { onmbr => 1, linear => 0 },
-# keyboard => 'de',
- autoSCSI => 0,
+ autoSCSI => 0,
mkbootdisk => "fd0", # no mkbootdisk if 0 or undef, find a floppy with 1
- packages => [ qw() ],
+ packages => [ qw() ],
partitioning => { clearall => $::testing, eraseBadPartitions => 0, auto_allocate => 0, autoformat => 0 },
partitions => [
{ mntpoint => "/boot", size => 16 << 11, type => 0x83 },
@@ -223,28 +239,53 @@ my $default = {
# { mntpoint => "/usr", size => 400 << 11, type => 0x83, growable => 1 },
],
shells => [ map { "/bin/$_" } qw(bash tcsh zsh ash ksh) ],
+ lang => 'us',
+ isUpgrade => 0,
+ installClass => 'beginner',
+ printer => {
+ str_type => $printer::printer_type[0],
+ QUEUE => "lp",
+ SPOOLDIR => "/var/spool/lpd/lp",
+ },
+# keyboard => 'de',
+# display => "192.168.1.9:0",
+
+
};
+
+#the big struct which contain, well everything (globals + the interactive methods ...)
+#if you want to do a kickstart file, you just have to add all the required fields (see for example
+#the variable $default)
$o = $::o = {
- lang => 'us',
- isUpgrade => 0,
- installClass => 'beginner',
-# intf => [ { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } ],
- default => $default,
- steps => \%installSteps,
- orderedSteps => \@orderedInstallSteps,
+ default => $default,
+ steps => \%installSteps,
+ orderedSteps => \@orderedInstallSteps,
- # for the list of fields available for user and superuser, see @etc_pass_fields in install_steps.pm
+ base => [ qw(basesystem initscripts console-tools mkbootdisk linuxconf anacron linux_logo rhs-hwdiag utempter ldconfig chkconfig ntsysv mktemp setup setuptool filesystem MAKEDEV SysVinit ash at authconfig bash bdflush binutils console-tools crontabs dev e2fsprogs ed etcskel file fileutils findutils getty_ps gpm grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time timeconfig tmpwatch util-linux vim-minimal vixie-cron which cpio) ],
+# for the list of fields available for user and superuser, see @etc_pass_fields in install_steps.pm
# user => { name => 'foo', password => 'bar', home => '/home/foo', shell => '/bin/bash', realname => 'really, it is foo' },
# superuser => { password => 'a', shell => '/bin/bash', realname => 'God' },
+# intf => [ { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } ],
- base => [ qw(basesystem initscripts console-tools mkbootdisk linuxconf anacron linux_logo rhs-hwdiag utempter ldconfig chkconfig ntsysv mktemp setup setuptool filesystem MAKEDEV SysVinit ash at authconfig bash bdflush binutils console-tools crontabs dev e2fsprogs ed etcskel file fileutils findutils getty_ps gpm grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time timeconfig tmpwatch util-linux vim-minimal vixie-cron which cpio) ],
-};
+#step : the current one
+#prefix
+#mouse
+#keyboard
+#netc
+#autoSCSI drives hds fstab
+#methods
+#packages compss
+#printer haveone entry(cf printer.pm)
+};
+# each step function are called with two arguments : clicked(because if you are a beginner you can force the
+# the step) and the entered number
sub selectLanguage {
lang::set($o->{lang} = $o->chooseLanguage);
- $o->{keyboard} = keyboard::setup($o->default("keyboard") || keyboard::lang2keyboard($o->{lang}));
+ $o->{keyboard} = $o->default("keyboard") || keyboard::lang2keyboard($o->{lang});
+ keyboard::setup($o->{keyboard});
addToBeDone {
unless ($o->{isUpgrade}) {
@@ -255,17 +296,20 @@ sub selectLanguage {
}
sub selectKeyboard {
- return if $o->{installClass} eq "beginner" && !$_[0];
+ my ($clicked) = $_[0];
+ return if $o->{installClass} eq "beginner" && !$clicked;
- $o->{keyboard} = keyboard::setup($o->chooseKeyboard);
+ $o->{keyboard} = $o->chooseKeyboard;
+ keyboard::setup($o->{keyboard});
+ #if we go back to the selectKeyboard, you must rewrite
addToBeDone {
keyboard::write($o->{prefix}, $o->{keyboard}) unless $o->{isUpgrade};
} 'doInstallStep';
}
sub selectPath {
- $o->{isUpgrade} = $o->selectInstallOrUpgrade;
+ $o->{isUpgrade} = $o->selectInstallOrUpgrade;
$o->{steps} = $o->{isUpgrade} ? \%upgradeSteps : \%installSteps;
$o->{orderedSteps} = $o->{isUpgrade} ? \@orderedUpgradeSteps : \@orderedInstallSteps;
}
@@ -344,9 +388,9 @@ sub configureTimezone {
return if ((-s $f) || 0) > 0 && $_[1] == 1 && !$_[0];
$o->timeConfig($f);
}
-sub configureServices { $o->servicesConfig }
-sub configurePrinter { $o->printerConfig }
-sub setRootPassword { $o->setRootPassword }
+sub configureServices { $o->servicesConfig }
+sub configurePrinter { $o->printerConfig }
+sub setRootPassword { $o->setRootPassword }
sub addUser {
$o->addUser;
addToBeDone {
@@ -374,7 +418,7 @@ sub main {
# if this fails, it's okay -- it might help with free space though
unlink "/sbin/install" unless $::testing;
- unlink "/sbin/insmod" unless $::testing;
+ unlink "/sbin/insmod" unless $::testing;
print STDERR "in second stage install\n";
log::openLog(($::testing || $o->{localInstall}) && 'debug.log');
@@ -388,6 +432,7 @@ sub main {
$ENV{PATH} = "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin:$o->{prefix}/sbin:$o->{prefix}/bin:$o->{prefix}/usr/sbin:$o->{prefix}/usr/bin:$o->{prefix}/usr/X11R6/bin";
$ENV{LD_LIBRARY_PATH} = "";
+ #really needed ??
spawnSync();
eval { spawnShell() };
@@ -423,6 +468,7 @@ sub main {
}
}
+
my $clicked = 0;
for ($o->{step} = $o->{steps}{first};; $o->{step} = getNextStep()) {
@@ -445,7 +491,7 @@ sub main {
last if $o->{step} eq 'exitInstall';
}
killCardServices();
-
+
log::l("installation complete, leaving");
}
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index ff36b8e5c..88e0acd66 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -97,7 +97,9 @@ sub setPackages {
$o->{packages}{$_}{base} = 1 foreach @{$o->{base}};
pkgs::setShowFromCompss($o->{compss}, $o->{installClass}, $o->{lang});
- pkgs::setSelectedFromCompssList($o->{compssList}, $o->{packages}, $size, $o->{installClass}, $o->{lang});
+ #PIXEL
+ my $size = 10;
+ pkgs::setSelectedFromCompssList($o->{compssList}, $o->{packages},$size , $o->{installClass}, $o->{lang});
}
sub addToBeDone(&$) {
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 1fbeeff0f..8a912f680 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -47,16 +47,14 @@ sub enteringStep($$) {
for (my $s = $o->{steps}{first}; $s; $s = $o->{steps}{$s}{next}) {
next if $o->{steps}{$s}{done} && !$o->{steps}{$s}{redoable};
+ next if $o->{steps}{$s}{reachable};
my $reachable = 1;
if (my $needs = $o->{steps}{$s}{needs}) {
my @l = ref $needs ? @$needs : $needs;
$reachable = min(map { $o->{steps}{$_}{done} || 0 } @l);
}
- if ($reachable && !$o->{steps}{$s}{reachable}) {
- $o->{steps}{$s}{reachable} = 1;
- $o->step_set_reachable($s);
- }
+ $o->{steps}{$s}{reachable} = 1, $o->step_set_reachable($s) if $reachable;
}
}
sub leavingStep($$) {
@@ -84,6 +82,11 @@ sub chooseLanguage($) {
sub chooseKeyboard($) {
$o->default("keyboard");
}
+sub choosePrinter($) {
+ $o->default("printer");
+}
+
+
sub selectInstallOrUpgrade($) {
$o->default("isUpgrade") || 0;
}
@@ -96,7 +99,7 @@ sub setupSCSI {
sub doPartitionDisks($$) {
my ($o, $hds) = @_;
- fsedit::auto_allocate($hds, $o->{default}{partitions});
+ fsedit::auto_allocate($hds, $o->default("partitions"));
}
sub rebootNeeded($) {
my ($o) = @_;
@@ -179,7 +182,11 @@ sub timeConfig {
}
sub servicesConfig {}
-sub printerConfig {}
+sub printerConfig {
+ my($o) = @_;
+ my $printer = $o->default("printer");
+ printer::configure_queue($printer) if $printer;
+}
sub setRootPassword($) {
my ($o) = @_;
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index cb279d352..5cf31678a 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -141,6 +141,72 @@ sub timeConfig {
$o->SUPER::timeConfig($f);
}
+sub printerConfig($) {
+ my($o) = @_;
+ $o->{printer}{want} =
+ $o->ask_yesorno(_("Printer"),
+ _("Would you like to configure a printer?"),
+ $o->{printer}{want});
+ return if !$o->{printer}{want};
+
+ #std info
+ #Don't wait, if the user enter something, you must remember it
+ #($o->{default}{printer}{QUEUE}, $o->{default}{printer}{SPOOLDIR}) =
+ $o->{printer}{QUEUE} ||= $o->{default}{printer}{QUEUE};
+ $o->{printer}{SPOOLDIR} ||= $o->{default}{printer}{SPOOLDIR};
+ $o->ask_from_entries_ref(_("Standard Printer Options"),
+ _("Every print queue (which print jobs are directed to) needs a
+ name (often lp) and a spool directory associated with it. What
+ name and directory should be used for this queue?"),
+ [_("Name of queue:"), _("Spool directory:")],
+ [\$o->{printer}{QUEUE}, \$o->{printer}{SPOOLDIR}],
+ );
+
+ $o->{printer}{str_type} =
+ $o->ask_from_list_(_("Select Printer Connection"),
+ _("How is the printer connected?"),
+ [keys %printer::printer_type],
+ ${$o->default("printer")}{str_type},
+ );
+ $o->{printer}{TYPE} = $printer::printer_type{$o->{printer}{str_type}};
+
+ if ($o->{printer}{TYPE} eq "LOCAL") {
+ eval { modules::load("lp"); };
+ my @port = ();
+ foreach ("lp0", "lp1", "lp2") {
+ local *LP;
+ push @port, "/dev/$_" if open LP, ">/dev/$_"
+ }
+ eval { modules::unload("lp") };
+
+ my $string = _("What device is your printer connected to
+ (note that /dev/lp0 is equivalent to LPT1:)?\n");
+ $string .= _("I detect :");
+ $string .= join(", ", @port);
+
+
+
+
+ } elsif ($o->{printer}{TYPE} eq "REMOTE") {
+ }
+
+
+
+# $entry =
+# do {
+#
+# }
+#
+# if ($type eq "local") {
+#
+# }
+ printer::set_prefix($o->{prefix});
+ printer::read_printer_db();
+
+ $o->SUPER::printerConfig;
+}
+
+
sub createBootdisk {
my ($o, $first_time) = @_;
my @l = detect_devices::floppies();
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 8c4bf24db..7151f7a34 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -8,7 +8,7 @@ use common qw(:common :functional);
# heritate from this class and you'll get all made interactivity for same steps.
# for this you need to provide
# - ask_from_listW(o, title, messages, arrayref, default) returns one string of arrayref
-# - ask_many_from_listW(o, title, messages, arrayref, arrayref2) returns one string of arrayref
+# - ask_many_from_listW(o, title, messages, arrayref, arrayref2) returns many strings of arrayref
#
# where
# - o is the object
@@ -39,20 +39,24 @@ sub ask_warn($$$) {
my ($o, $title, $message) = @_;
ask_from_list($o, $title, $message, [ _("Ok") ]);
}
+
sub ask_yesorno($$$;$) {
my ($o, $title, $message, $def) = @_;
ask_from_list_($o, $title, $message, [ __("Yes"), __("No") ], $def ? "No" : "Yes") eq "Yes";
}
+
sub ask_okcancel($$$;$) {
my ($o, $title, $message, $def) = @_;
ask_from_list_($o, $title, $message, [ __("Ok"), __("Cancel") ], $def ? "Cancel" : "Ok") eq "Ok";
}
+
sub ask_from_list_($$$$;$) {
my ($o, $title, $message, $l, $def) = @_;
untranslate(
ask_from_list($o, $title, $message, [ map { translate($_) } @$l ], translate($def)),
@$l);
}
+
sub ask_from_list($$$$;$) {
my ($o, $title, $message, $l, $def) = @_;
@@ -86,6 +90,23 @@ sub ask_from_entry($$$;$) {
$o->ask_from_entryW($title, $message, $def);
}
+sub ask_from_entries($$$$;$) {
+ my ($o, $title, $message, $l, $def) = @_;
+
+ my $val = [ map { my $i = $_; \$i } @$def ];
+ $o->ask_from_entries_ref($title, $message, $l, $val) ?
+ [ map { $$_ } @$val ] : undef;
+
+}
+
+sub ask_from_entries_ref($$$$;$) {
+ my ($o, $title, $message, $l, $val) = @_;
+
+ $message = ref $message ? $message : [ $message ];
+
+ $o->ask_from_entries_refW($title, $message, $l, $val)
+
+}
sub wait_message($$$) {
my ($o, $title, $message) = @_;
diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm
index 47e978229..fcebb2b08 100644
--- a/perl-install/interactive_gtk.pm
+++ b/perl-install/interactive_gtk.pm
@@ -7,7 +7,7 @@ use vars qw(@ISA);
@ISA = qw(interactive);
use interactive;
-use common qw(:common);
+use common qw(:common :functional);
use my_gtk qw(:helpers :wrappers);
1;
@@ -25,7 +25,6 @@ sub ask_from_entryW {
$w->_ask_from_entry(@$messages);
$w->main;
}
-
sub ask_from_listW {
my ($o, $title, $messages, $l, $def) = @_;
@@ -73,6 +72,34 @@ sub ask_many_from_list_refW {
$w->main && $val;
}
+
+sub ask_from_entries_refW {
+ my ($o, $title, $messages, $l, $val) = @_;
+
+ my @entry_list = mapn {
+ my $entry = new Gtk::Entry;
+ my $ref = $_[1];
+ my $update = sub {
+ ${$ref} = $entry->get_text;
+ };
+ $entry->signal_connect(changed => $update);
+ $entry->set_text(${$_[1]}) if ${$_[1]};
+ $entry->set_visibility(0) if $_[0] =~ /password/;
+ &$update;
+ [($_[0], $entry)];
+ } $l, $val;
+
+ my $w = my_gtk->new($title, %$o);
+ gtkadd($w->{window},
+ gtkpack(
+ create_box_with_title($w, @$messages),
+ create_packtable({}, @entry_list),
+ $w->create_okcancel));
+
+ $w->main();
+}
+
+
sub wait_messageW($$$) {
my ($o, $title, $message) = @_;
diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm
index 514f87e64..bf49804df 100644
--- a/perl-install/keyboard.pm
+++ b/perl-install/keyboard.pm
@@ -20,7 +20,6 @@ my %lang2keyboard =
# [1] = name for loadkeys, [2] = extension for Xmodmap
-my @fields =
my %keyboards = (
# armenian xmodmap have to be checked...
# "am" => [ __("Armenian"), "am-armscii8", "am" ],
@@ -115,8 +114,6 @@ sub setup($) {
load(cat_($file));
}
eval { run_program::run('xmodmap', "/usr/share/xmodmap/xmodmap.$o->[2]") };
-
- $keyboard;
}
sub write($$) {
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index fca3d223c..1fd767a02 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -10,7 +10,6 @@ use log;
# key (to be used in $LC_ALL), [0] = english name, [1] = charset encoding,
# [2] = value for $LANG, [3] = value for LANGUAGE (a list of possible
# languages, carefully choosen)
-my @fields =
my %languages = (
'en' => [ 'English', undef, 'en', 'en_US' ],
'fr_FR' => [ 'French (France)', 'iso-8859-1', 'fr', 'fr_FR' ],
@@ -105,9 +104,9 @@ sub set {
my $lang = shift;
if ($lang) {
- $ENV{LC_ALL} = $lang;
- $ENV{LANG} = $languages{$lang}[2];
- $ENV{LANGUAGES} = $languages{$lang}[3];
+ $ENV{LC_ALL} = $lang;
+ $ENV{LANG} = $languages{$lang}[2];
+ $ENV{LANGUAGES} = $languages{$lang}[3];
if (my $f = $languages{$lang}[1]) { load_font($f) }
} else {
# stick with the default (English) */
@@ -153,7 +152,7 @@ sub load_font {
if (my $c = $charsets{$charset}) {
log::l("loading " . $c . " font");
$fontFile = $c->[0];
- $fontSet = $c->[2];
+ $fontSet = $c->[2];
}
# text mode font
diff --git a/perl-install/log.pm b/perl-install/log.pm
index cab808f5e..1d4ba05b4 100644
--- a/perl-install/log.pm
+++ b/perl-install/log.pm
@@ -1,7 +1,8 @@
+package log;
+
use diagnostics;
use strict;
-package log;
my $logOpen = 0;
my $logDebugMessages = 0;
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 7e5b1cac2..d036573c7 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -13,6 +13,21 @@ use log;
my %conf;
my %deps = ();
+
+my @neOptions = (
+ [ "io=", "Base IO port:", "0x300:0x280:0x320:0x340:0x360" ],
+ [ "irq=", "IRQ level:", "" ],
+);
+
+my @de4x5Options = (
+ [ "io=", "Base IO port:", "0x0b" ],
+);
+
+my @cdu31aOptions = (
+ [ "cdu31a_port=", "Base IO port:", "" ],
+ [ "cdu31a_irq=", "IRQ level:", "" ],
+);
+
#
#my %knownAliases = (
# eth => { type => 'net', minor => 'ethernet' },
@@ -84,7 +99,6 @@ my %deps = ();
# "tcic" => [ 1, undef, 0, '' ],
# "vfat" => [ 1, undef, 0, '' ],
#);
-
my @drivers_by_category = (
[ \&detect_devices::hasEthernet, 'net', 'ethernet', {
"3c509" => "3com 3c509",
@@ -227,16 +241,26 @@ sub text2driver($) {
sub load($;$@) {
my ($name, $type, @options) = @_;
-
- $conf{$name}{loaded} and return;
-
- $type ||= $drivers{$name}{type};
-
- load($_, 'prereq') foreach @{$deps{$name}};
- load_raw($name, @options);
+ if ($::testing) {
+ log::l("i try to install $name module");
+ } else {
+
+ $conf{$name}{loaded} and return;
+
+ $type ||= $drivers{$name}{type};
+
+ load($_, 'prereq') foreach @{$deps{$name}};
+ load_raw($name, @options);
+ }
}
-sub unload($) { run_program::run("rmmod", $_[0]); }
+sub unload($) {
+ if ($::testing) {
+ log::l("rmmod $_[0]");
+ } else {
+ run_program::run("rmmod", $_[0]);
+ }
+}
sub load_raw($@) {
my ($name, @options) = @_;