summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-08-24 19:02:16 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-08-24 19:02:16 +0000
commit10b649b6503f47388f1548c8ba9391dd6ce0284e (patch)
tree6bc1fe238a7a28721cfd15b52946e67d236c8277 /perl-install
parented18d4ad1743445dc1c49d65b5a64a0c73510edd (diff)
downloaddrakx-backup-do-not-use-10b649b6503f47388f1548c8ba9391dd6ce0284e.tar
drakx-backup-do-not-use-10b649b6503f47388f1548c8ba9391dd6ce0284e.tar.gz
drakx-backup-do-not-use-10b649b6503f47388f1548c8ba9391dd6ce0284e.tar.bz2
drakx-backup-do-not-use-10b649b6503f47388f1548c8ba9391dd6ce0284e.tar.xz
drakx-backup-do-not-use-10b649b6503f47388f1548c8ba9391dd6ce0284e.zip
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Xconfig.pm4
-rw-r--r--perl-install/Xconfigurator.pm17
-rw-r--r--perl-install/install2.pm56
-rw-r--r--perl-install/install_any.pm21
-rw-r--r--perl-install/install_steps.pm12
-rw-r--r--perl-install/install_steps_interactive.pm58
-rw-r--r--perl-install/interactive.pm32
-rw-r--r--perl-install/interactive_gtk.pm12
-rw-r--r--perl-install/interactive_stdio.pm18
-rw-r--r--perl-install/pkgs.pm15
-rw-r--r--perl-install/share/themes-savane.rc2
11 files changed, 143 insertions, 104 deletions
diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm
index 248cf125f..1d1babd49 100644
--- a/perl-install/Xconfig.pm
+++ b/perl-install/Xconfig.pm
@@ -18,12 +18,12 @@ sub keymap_translate {
sub getinfo {
my $o = {};
-# getinfoFromXF86Config($o);
+ getinfoFromXF86Config($o);
getinfoFromSysconfig($o);
+ $o->{mouse}{emulate3buttons} = 1;
unless ($o->{mouse}{xtype}) {
my ($type, $dev) = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed";
- $o->{mouse}{emulate3buttons} = 1;
$o->{mouse}{xtype} ||= $type;
$o->{mouse}{device} ||= "/dev/$dev";
}
diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm
index 16ecde778..7ff4566b7 100644
--- a/perl-install/Xconfigurator.pm
+++ b/perl-install/Xconfigurator.pm
@@ -604,6 +604,22 @@ sub XF86check_link {
}
}
+sub show_info {
+ my ($o) = @_;
+ my $info;
+
+ $info .= _("Keyboard language: %s\n", $o->{keyboard}{xkb_keymap});
+ $info .= _("Mouse type: %s\n", $o->{mouse}{xtype});
+ $info .= _("Mouse device: %s\n", $o->{mouse}{device}) if $::expert;
+ $info .= _("Monitor: %s\n", $o->{monitor}{type});
+ $info .= _("Monitor HorizSync: %s\n", $o->{monitor}{hsyncrange}) if $::expert;
+ $info .= _("Monitor VertRefresh: %s\n", $o->{monitor}{vsyncrange}) if $::expert;
+ $info .= _("Graphic card: %s\n", $o->{card}{type});
+ $info .= _("Graphic memory: %s KB\n", $o->{card}{memory}) if $o->{card}{memory};
+ $info .= _("XFree86 server: %s\n", $o->{card}{server});
+
+ $in->ask_warn('', $info);
+}
# * Program entry point.
sub main {
@@ -632,6 +648,7 @@ sub main {
delete $o->{card}{depth};
resolutionsConfiguration($o, 'nowarning');
},
+ __("Show information") => sub { show_info($o) },
__("Test again") => sub { $ok = testFinalConfig($o, 1) },
__("Quit") => sub { $quit = 1 },
);
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 5bc1b9a30..17bd8f1b1 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -109,7 +109,7 @@ my @installSteps = (
choosePackages => [ __("Choose packages to install"), 1, 1, "selectInstallClass" ],
doInstallStep => [ __("Install system"), 1, -1, ["formatPartitions", "selectPath"] ],
# configureMouse => [ __("Configure mouse"), 0, 0 ],
- finishNetworking => [ __("Configure networking"), 1, 1, "formatPartitions" ],
+ configureNetwork => [ __("Configure networking"), 1, 1, "formatPartitions" ],
# configureTimezone => [ __("Configure timezone"), 0, 0 ],
# configureServices => [ __("Configure services"), 0, 0 ],
# configurePrinter => [ __("Configure printer"), 0, 0 ],
@@ -145,19 +145,14 @@ my @serverPartitioning = (
);
my $default = {
+ lang => 'us',
+ isUpgrade => 0,
+ installClass => 'beginner',
# display => "192.168.1.9:0",
- # 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' },
-
-# lang => 'fr',
-# isUpgrade => 0,
-# installClass => 'beginner',
bootloader => { onmbr => 1, linear => 0 },
autoSCSI => 0,
mkbootdisk => 0,
- 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) ],
packages => [ qw() ],
partitionning => { clearall => $::testing, eraseBadPartitions => 1, auto_allocate => 0, autoformat => 1 },
partitions => [
@@ -168,7 +163,21 @@ my $default = {
],
shells => [ map { "/bin/$_" } qw(bash tcsh zsh ash) ],
};
-$o = $::o = { default => $default, steps => \%installSteps, orderedSteps => \@orderedInstallSteps };
+$o = $::o = {
+# lang => 'fr',
+# isUpgrade => 0,
+# installClass => 'beginner',
+
+ default => $default,
+ steps => \%installSteps,
+ orderedSteps => \@orderedInstallSteps,
+
+ # 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' },
+
+ 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) ],
+};
sub selectLanguage {
@@ -192,11 +201,11 @@ sub selectPath {
sub selectInstallClass {
$o->{installClass} = $o->selectInstallClass(@install_classes);
$::expert = $o->{installClass} eq "expert";
- $o->{autoSCSI} = $o->default("autoSCSI") || $o->{installClass} eq "beginner";
}
-sub setupSCSI {
- $o->setupSCSI($o->default("autoSCSI") && $_[0]);
+sub setupSCSI {
+ $o->{autoSCSI} ||= $o->{installClass} eq "beginner";
+ $o->setupSCSI($o->{autoSCSI} && !$_[0]);
}
sub partitionDisks {
@@ -239,34 +248,35 @@ sub formatPartitions {
$o->formatPartitions(@{$o->{fstab}});
fs::mount_all([ grep { isExt2($_) || isSwap($_) } @{$o->{fstab}} ], $o->{prefix});
+
+ mkdir "$o->{prefix}/$_", 0755 foreach qw(dev etc home mnt tmp var var/tmp var/lib var/lib/rpm);
+ network::add2hosts("$o->{prefix}/etc/hosts", "127.0.0.1", "localhost.localdomain");
+ pkgs::init_db($o->{prefix}, $o->{isUpgrade});
}
sub choosePackages {
- my @p = @{$o->{default}{base}};
-
- unless ($o->{packages}) {
+ if ($o->{steps}{$o->{step}}{entered} == 1) {
$o->{packages} = pkgs::psUsingDirectory();
pkgs::getDeps($o->{packages});
$o->{compss} = pkgs::readCompss($o->{packages});
- push @p, "kernel-smp" if smp::detect();
+ push @{$o->{base}}, "kernel-smp" if smp::detect();
- foreach (@p) { $o->{packages}{$_}{base} = 1 }
+ foreach (@{$o->{base}}) { $o->{packages}{$_}{base} = 1 }
pkgs::setCompssSelected($o->{compss}, $o->{packages}, $o->{installClass});
}
$o->choosePackages($o->{packages}, $o->{compss});
- foreach (@p) { $o->{packages}{$_}{selected} = 1 }
+ foreach (@{$o->{base}}) { $o->{packages}{$_}{selected} = 1 }
}
sub doInstallStep {
- $o->beforeInstallPackages;
$o->installPackages($o->{packages});
$o->afterInstallPackages;
}
sub configureMouse { $o->mouseConfig }
-sub finishNetworking { $o->finishNetworking }
+sub configureNetwork { $o->configureNetwork }
sub configureTimezone { $o->timeConfig }
sub configureServices { $o->servicesConfig }
sub setRootPassword { $o->setRootPassword }
@@ -316,7 +326,7 @@ sub main {
eval { spawnShell() };
# needed very early for install_steps_graphical
- @{$o->{mouse}}{"xtype", "device"} = install_any::mouse_detect() unless $::testing;
+ $o->{mouse} = install_any::mouse_detect() unless $::testing;
$o = install_steps_graphical->new($o);
@@ -332,7 +342,7 @@ sub main {
my $clicked = 0;
for ($o->{step} = $o->{steps}{first};; $o->{step} = getNextStep()) {
$o->enteringStep($o->{step});
- $o->{steps}{$o->{step}}{entered} = 1;
+ $o->{steps}{$o->{step}}{entered}++;
eval {
&{$install2::{$o->{step}}}($clicked);
};
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 0560e1016..155f2ef04 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK);
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- all => [ qw(versionString getNextStep doSuspend spawnSync spawnShell addToBeDone) ],
+ all => [ qw(versionString getNextStep spawnSync spawnShell addToBeDone) ],
);
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
@@ -40,20 +40,6 @@ sub getNextStep {
$s;
}
-sub doSuspend {
- exit 1 if $::o->{localInstall} || $::testing;
-
- if (my $pid = fork) {
- waitpid $pid, 0;
- } else {
- print "\n\nType <exit> to return to the install program.\n\n";
- exec {"/bin/sh"} "-/bin/sh";
- warn "error execing /bin/sh";
- sleep 5;
- exit 1;
- }
-}
-
sub spawnSync {
return if $::o->{localInstall} || $::testing;
@@ -84,8 +70,9 @@ sub spawnShell {
}
sub mouse_detect() {
- my ($type, $dev) = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed";
- $type, $dev;
+ my %l;
+ @l{qw(type xtype device)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed";
+ \%l;
}
sub shells($) {
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 7184dde74..5c4a189fb 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -118,12 +118,6 @@ sub choosePackages($$$) {
my ($o, $packages, $compss) = @_;
}
-sub beforeInstallPackages($) {
- mkdir "$o->{prefix}/$_", 0755 foreach qw(dev etc home mnt tmp var var/tmp var/lib var/lib/rpm);
- network::add2hosts("$o->{prefix}/etc/hosts", "127.0.0.1", "localhost.localdomain");
- pkgs::init_db($o->{prefix}, $o->{isUpgrade});
-}
-
sub installPackages($$) {
my ($o, $packages) = @_;
my $toInstall = [ grep { $_->{selected} && !$_->{installed} } values %$packages ];
@@ -143,7 +137,7 @@ sub mouseConfig($) {
#TODO
}
-sub finishNetworking($) {
+sub configureNetwork($) {
my ($o) = @_;
my $etc = "$o->{prefix}/etc";
#
@@ -162,7 +156,7 @@ sub servicesConfig {}
sub setRootPassword($) {
my ($o) = @_;
- my %u = %{$o->default("superuser")};
+ my %u = %{$o->{superuser}};
my $p = $o->{prefix};
$u{password} = crypt_($u{password}) if $u{password};
@@ -185,7 +179,7 @@ sub setRootPassword($) {
sub addUser($) {
my ($o) = @_;
- my %u = %{$o->default("user")};
+ my %u = %{$o->{user}};
my $p = $o->{prefix};
my @passwd = cat_("$p/etc/passwd");;
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 766220388..dca0255d0 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -1,24 +1,5 @@
package install_steps_interactive;
-# 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
-#
-# where
-# - o is the object
-# - title is a string
-# - messages is an refarray of strings
-# - default is an optional string (default is in arrayref)
-# - arrayref is an arrayref of strings
-# - arrayref2 contains booleans telling the default state,
-#
-# ask_from_list and ask_from_list_ are wrappers around ask_from_biglist and ask_from_smalllist
-#
-# ask_from_list_ just translate arrayref before calling ask_from_list and untranslate the result
-#
-# ask_from_listW should handle differently small lists and big ones.
-
use diagnostics;
use strict;
@@ -99,13 +80,13 @@ sub rebootNeeded($) {
sub choosePartitionsToFormat($$) {
my ($o, $fstab) = @_;
+ $o->SUPER::choosePartitionsToFormat($fstab) if $o->{steps}{$o->{step}}{entered} == 1;
+
my @l = grep { $_->{mntpoint} && isExt2($_) || isSwap($_) } @$fstab;
- my @r = $o->ask_many_from_list('', _("Choose the partitions you want to format"),
- [ map { $_->{mntpoint} || type2name($_->{type}) . " ($_->{device})" } @l ],
- [ map { $_->{notFormatted} } @l ]);
+ 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";
- my $i = 0;
- $_->{toFormat} = $r[$i++] foreach @l;
}
sub formatPartitions {
@@ -119,6 +100,35 @@ sub formatPartitions {
}
}
+sub configureNetwork($) {
+ my ($o, $first_time) = @_;
+ my $r = '';
+
+ if ($o->{intf}) {
+ if ($first_time) {
+ my @l = (
+ __("Keep the current IP configuration"),
+ __("Reconfigure network now"),
+ __("Don't set up networking"),
+ );
+ $r = $o->ask_from_list_(_("Network Configuration"),
+ _("LAN networking has already been configured. Do you want to:"),
+ [ @l ]);
+ !$r || $r =~ /^Don't/ and return;
+ }
+ } else {
+ $o->ask_yesorno(_("Network Configuration"),
+ _("Do you want to configure LAN (not dialup) networking for your installed system?")) or return;
+ }
+
+ if ($r !~ /^Keep/) {
+ $o->configureNetworkAsk or return;
+ }
+ $o->SUPER::configureNetwork;
+}
+
+
+
sub createBootdisk($) {
my ($o) = @_;
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index b0bd6bb7d..70f54b57b 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -5,6 +5,26 @@ use strict;
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
+#
+# where
+# - o is the object
+# - title is a string
+# - messages is an refarray of strings
+# - default is an optional string (default is in arrayref)
+# - arrayref is an arrayref of strings
+# - arrayref2 contains booleans telling the default state,
+#
+# ask_from_list and ask_from_list_ are wrappers around ask_from_biglist and ask_from_smalllist
+#
+# ask_from_list_ just translate arrayref before calling ask_from_list and untranslate the result
+#
+# ask_from_listW should handle differently small lists and big ones.
+
+
1;
sub new($$) {
@@ -41,12 +61,20 @@ sub ask_from_list($$$$;$) {
$o->ask_from_listW($title, $message, $l, $def || $l->[0]);
}
+sub ask_many_from_list_ref($$$$;$) {
+ my ($o, $title, $message, $l, $val) = @_;
+
+ $message = ref $message ? $message : [ $message ];
+
+ $o->ask_many_from_list_refW($title, $message, $l, $val);
+}
sub ask_many_from_list($$$$;$) {
my ($o, $title, $message, $l, $def) = @_;
- $message = ref $message ? $message : [ $message ];
+ my $val = [ map { my $i = $_; \$i } @$def ];
- $o->ask_many_from_listW($title, $message, $l, $def);
+ $o->ask_many_from_list_ref($title, $message, $l, $val) ?
+ [ map { $$_ } @$val ] : undef;
}
sub ask_from_entry($$$;$) {
diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm
index 7c52e0d97..94456e9c0 100644
--- a/perl-install/interactive_gtk.pm
+++ b/perl-install/interactive_gtk.pm
@@ -52,9 +52,8 @@ sub ask_from_listW {
}
}
-sub ask_many_from_listW {
- my ($o, $title, $messages, $list, $default) = @_;
- my @rr = @$default;
+sub ask_many_from_list_refW {
+ my ($o, $title, $messages, $list, $val) = @_;
my $n = 0;
my $w = my_gtk->new('', %$o);
gtkadd($w->{window},
@@ -63,16 +62,15 @@ sub ask_many_from_listW {
map {
my $nn = $n++;
my $o = Gtk::CheckButton->new($_);
- $o->set_active($rr[$nn]);
- $o->signal_connect(clicked => sub { $rr[$nn] = !$rr[$nn] });
+ $o->set_active(${$val->[$nn]});
+ $o->signal_connect(clicked => sub { ${$val->[$nn]} = !${$val->[$nn]} });
$o;
} @$list),
$w->create_okcancel,
)
);
$w->{ok}->grab_focus;
- $w->main or return;
- @rr;
+ $w->main && $val;
}
sub wait_messageW($$$) {
diff --git a/perl-install/interactive_stdio.pm b/perl-install/interactive_stdio.pm
index de848b9e6..6fb1fd58c 100644
--- a/perl-install/interactive_stdio.pm
+++ b/perl-install/interactive_stdio.pm
@@ -55,14 +55,14 @@ sub ask_from_listW {
}
}
-sub ask_many_from_listW {
- my ($o, $title, $messages, $list, $default) = @_;
+sub ask_many_from_list_refW {
+ my ($o, $title, $messages, $list, $val) = @_;
my @defaults;
print map { "$_\n" } @$messages;
my $n = 0; foreach (@$list) {
$n++;
print "$n: $_\n";
- push @defaults, $n if $default->[$n - 1];
+ push @defaults, $n if ${$val->[$n - 1]};
}
my $i;
TRY_AGAIN:
@@ -70,11 +70,15 @@ sub ask_many_from_listW {
print _("Your choice? (default %s enter `none' for none) ", join(',', @defaults));
$i = readln();
my @t = split ',', $i;
- foreach (@t) { check_it($_, $n) or goto TRY_AGAIN }
+ if ($i =~ /^none$/i) {
+ @t = ();
+ } else {
+ foreach (@t) { check_it($_, $n) or goto TRY_AGAIN }
+ }
- my @rr = (0) x @$list;
- $rr[$_ - 1] = 1 foreach @t;
- @rr;
+ $$_ = 0 foreach @$val;
+ ${$val->[$_ - 1]} = 1 foreach @t;
+ $val;
}
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 970fa2209..d10713c5b 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -11,19 +11,12 @@ use smp;
use fs;
use lang;
-my @skipThesesPackages = qw(XFree86-8514 XFree86-AGX XFree86-FBDev XFree86-Mach32 XFree86-Mach64
- XFree86-Mach8 XFree86-Mono XFree86-P9000 XFree86-S3 XFree86-S3V
- XFree86-SVGA XFree86-VGA16 XFree86-W32 XFree86-I128 XFree86-Sun
- XFree86-SunMono XFree86-Xnest postfix
- XFree86-Sun24 XFree86-3DLabs kernel-boot metroess metrotmpl);
-
1;
-sub skipThisPackage { member($_[0], @skipThesesPackages) }
sub Package {
my ($packages, $name) = @_;
- $packages->{$name} ;# or die "unknown package $name"; hack hack :(
+ $packages->{$name} or log::l("unknown package $name") && undef;
}
sub select($$;$) {
@@ -140,10 +133,8 @@ sub readCompss($) {
my ($options, $name) = /^(\S*)\s+(.*?)\s*$/ or die "bad line in compss: $_";
if ($name =~ /(.*):$/) {
- if ($category) {
- push @compss, $category;
- $ps = [];
- }
+ push @compss, $category if $category;
+ $ps = [];
$category = { options => $options, name => $1, packages => $ps };
} else {
my $p = $packages->{$name} or log::l("unknown package $name (in compss)"), next;
diff --git a/perl-install/share/themes-savane.rc b/perl-install/share/themes-savane.rc
index 74f6391f2..dcc60633a 100644
--- a/perl-install/share/themes-savane.rc
+++ b/perl-install/share/themes-savane.rc
@@ -29,7 +29,7 @@ style "button"
style "background"
{
- bg[NORMAL] = { 0.67, 0.33, 1.0 }
+ bg[NORMAL] = { 1.0, 0.67, 0 }
}
widget_class "*" style "any"