From d5e061896a35a49a50124949c2882ac9cbe94589 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 29 Aug 1999 20:15:36 +0000 Subject: no_comment --- perl-install/Makefile | 1 + perl-install/Xconfigurator.pm | 6 ++-- perl-install/commands.pm | 10 ++++++ perl-install/detect_devices.pm | 10 +++--- perl-install/ftp.pm | 54 +++++++++++++++++-------------- perl-install/install2.pm | 8 +++-- perl-install/install_any.pm | 4 +-- perl-install/install_steps.pm | 6 ++-- perl-install/install_steps_interactive.pm | 6 ++-- perl-install/interactive_gtk.pm | 12 +++---- perl-install/interactive_stdio.pm | 2 +- perl-install/lang.pm | 2 +- perl-install/modules.pm | 13 +++++--- perl-install/network.pm | 15 +++++---- perl-install/partition_table_raw.pm | 2 +- perl-install/pkgs.pm | 5 ++- perl-install/share/install.rc | 8 ++++- perl-install/share/themes-blackwhite.rc | 2 -- perl-install/share/themes-blue.rc | 2 -- perl-install/share/themes-savane.rc | 2 -- 20 files changed, 98 insertions(+), 72 deletions(-) diff --git a/perl-install/Makefile b/perl-install/Makefile index fe296c0a4..d4e7e68c0 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -124,6 +124,7 @@ get_needed_files: $(SO_FILES) done mv -f $(DEST)/bin/* $(DEST)/sbin/* $(DEST)/usr/bin + cd $(DEST)/usr/bin ; mv insmod insmod_ rmdir $(DEST)/bin $(DEST)/sbin ln -sf ash $(DEST)/usr/bin/sh diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index d8609fcc2..84ff9b803 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -176,7 +176,7 @@ sub cardConfiguration(;$$) { $card->{flags}{needVideoRam} and $card->{memory} ||= $videomemory{$in->ask_from_list_('', - _("Give your graphic card memory size"), + _("Select the memory size of your graphic card"), [ sort { $videomemory{$a} <=> $videomemory{$b} } keys %videomemory])}; $card; @@ -221,7 +221,7 @@ sub testFinalConfig($;$) { my ($o, $auto) = @_; $o->{monitor}{hsyncrange} && $o->{monitor}{vsyncrange} or - $in->ask_warn('', _("Monitor not configured yet")), return; + $in->ask_warn('', _("Monitor not configured")), return; $o->{card}{server} or $in->ask_warn('', _("Graphic card not configured yet")), return; @@ -234,7 +234,7 @@ sub testFinalConfig($;$) { write_XF86Config($o, $::testing ? $tmpconfig : "$prefix/etc/X11/XF86Config"); $auto - or $in->ask_yesorno(_("Test configuration"), _("Do you want to test configuration?")) + or $in->ask_yesorno(_("Test configuration"), _("Do you want to test the configuration?")) or return 1; my $pid; unless ($pid = fork) { diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 1e09d7329..e2c5ba97b 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -387,3 +387,13 @@ sub unpack_ { } } } + +sub insmod { + my $name = shift; + my $f = "/tmp/$name.o"; + require 'run_program.pm'; + run_program::run("cd /tmp ; bzip2 -cd /lib/modules.cpio.bz2 | cpio -i $name.o"); + -r $f or die "can't find module $name"; + run_program::run("insmod_", $f, @_) or die("insmod $name failed"); + unlink $f; +} diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index b8e9c9993..19bae0339 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -5,6 +5,7 @@ use strict; use log; use common qw(:common :file); +use devices; use c; @@ -30,9 +31,8 @@ sub get { sub hds() { grep { $_->{type} eq 'hd' } get(); } sub cdroms() { grep { $_->{type} eq 'cdrom' } get(); } sub floppies() { - my @l = grep { $_->{type} eq 'fd' } get(); - unshift @l, "fd0" if tryOpen("fd0"); - @l; + (grep { tryOpen($_) } qw(fd0 fd1)), + (grep { $_->{type} eq 'fd' } get()); } sub hasSCSI() { @@ -134,7 +134,7 @@ sub getDAC960() { sub getNet() { - grep { hasNetDevice($_) } qw(eth0 tr0 plip0 plip1 plip2 fddi0); + grep { hasNetDevice($_) } qw(eth0 eth1 eth2 eth3 tr0 plip0 plip1 plip2 fddi0); } sub getPlip() { foreach (0..2) { @@ -151,5 +151,5 @@ sub hasNetDevice($) { c::hasNetDevice($_[0]) } sub tryOpen($) { local *F; - sysopen F, "/dev/$_[0]", c::O_NONBLOCK(); + sysopen F, devices::make($_[0]), c::O_NONBLOCK(); } diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm index e6c27e68c..0879a8b72 100644 --- a/perl-install/ftp.pm +++ b/perl-install/ftp.pm @@ -7,14 +7,18 @@ use log; # non-rentrant!! -my %options = (Passive => 1); -$options{Firewall} = $ENV{PROXY} if $ENV{PROXY}; -$options{Port} = $ENV{PROXYPORT} if $ENV{PROXYPORT}; -my @l; -unless ($ENV{HOST}) { - # must be in kickstart, using URLPREFIX to find out information - ($ENV{LOGIN}, $ENV{PASSWORD}, $ENV{HOST}, $ENV{PREFIX}) = @l = - $ENV{URLPREFIX} =~ m| +1; + + +sub new { + my %options = (Passive => 1); + $options{Firewall} = $ENV{PROXY} if $ENV{PROXY}; + $options{Port} = $ENV{PROXYPORT} if $ENV{PROXYPORT}; + my @l; + unless ($ENV{HOST}) { + # must be in kickstart, using URLPREFIX to find out information + ($ENV{LOGIN}, $ENV{PASSWORD}, $ENV{HOST}, $ENV{PREFIX}) = @l = + $ENV{URLPREFIX} =~ m| :// (?: ([^:]*) # login (?: :([^@]*))? # password @@ -22,28 +26,28 @@ unless ($ENV{HOST}) { ([^/]*) # host /?(.*) # prefix |x; -} -unless ($ENV{LOGIN}) { - $ENV{LOGIN} = 'anonymous'; - $ENV{PASSWORD} = 'mdkinst@test'; -} - -my $host = $ENV{HOST}; -if ($host !~ /^[.\d]+$/) { - $host = join ".", unpack "C4", (gethostbyname $host)[4]; - print ">>>>> $host <<<<<<\n"; + } + unless ($ENV{LOGIN}) { + $ENV{LOGIN} = 'anonymous'; + $ENV{PASSWORD} = 'mdkinst@test'; + } + + my $host = $ENV{HOST}; + if ($host !~ /^[.\d]+$/) { + $host = join ".", unpack "C4", (gethostbyname $host)[4]; + } + + my $ftp = Net::FTP->new($host, %options) or die; + $ftp->login($ENV{LOGIN}, $ENV{PASSWORD}) or die; + $ftp->binary; + + $ftp; } -my $ftp = Net::FTP->new($host, %options) or die; -$ftp->login($ENV{LOGIN}, $ENV{PASSWORD}) or die; -$ftp->binary; my $retr; - -1; - - sub getFile($) { + $ftp ||= new(); $retr->close if $retr; $retr = $ftp->retr($ENV{PREFIX} . "/" . install_any::relGetFile($_[0])); } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 8e5361933..2c082a6b4 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -48,7 +48,7 @@ customized installation, this Install Class is for you."), setupSCSI => __("The system did not detect a SCSI card. If you have one (or several) -click on \"Yes\" and choose the module(s) to be tested. Otherwise, +click on \"Yes\" and choose the module\(s) to be tested. Otherwise, select \"No\". If you don't know if your computer has SCSI interfaces, consult the @@ -173,7 +173,7 @@ my @installSteps = ( configureServices => [ __("Configure services"), 0, 0 ], configurePrinter => [ __("Configure printer"), 0, 0 ], setRootPassword => [ __("Set root password"), 1, 1, "formatPartitions" ], - addUser => [ __("Add a user"), 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" ], @@ -319,6 +319,7 @@ sub configureMouse { $o->mouseConfig } sub configureNetwork { $o->configureNetwork($o->{steps}{$o->{step}}{entered} == 1 && !$_[0]) } sub configureTimezone { $o->timeConfig } sub configureServices { $o->servicesConfig } +sub configurePrinter { $o->printerConfig } sub setRootPassword { $o->setRootPassword } sub addUser { $o->addUser; @@ -379,11 +380,12 @@ sub main { modules::load_deps("/modules/modules.dep"); modules::read_conf("/tmp/conf.modules"); + modules::read_already_loaded(); while (@_) { local $_ = shift; if (/--method/) { - $_ = shift; + $o->{method} = $_ = shift; if (/ftp/) { require 'ftp.pm'; local $^W = 0; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 4ec01334c..5dfea7d79 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -87,8 +87,8 @@ sub shells($) { sub setPackages { my ($o) = @_; - eval { $o->{packages} = pkgs::psUsingHdlist() }; - $@ and $o->{packages} = pkgs::psUsingDirectory(); + eval { $o->{packages} = pkgs::psUsingHdlist() } if $o->{method} ne "nfs"; + $o->{packages} = pkgs::psUsingDirectory() if $o->{method} eq "nfs" || $@; pkgs::getDeps($o->{packages}); $o->{compss} = pkgs::readCompss($o->{packages}); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 87a43f815..8e086f70d 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -160,12 +160,14 @@ sub configureNetwork($) { network::write_resolv_conf("$etc/resolv.conf", $o->{netc}); network::write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_) foreach @{$o->{intf}}; network::add2hosts("$etc/hosts", $o->{netc}{HOSTNAME}, map { $_->{IPADDR} } @{$o->{intf}}); -# syscall_('sethostname', $hostname, length $hostname) or warn "sethostname failed: $!"; + network::sethostname($o->{netc}) unless $::testing; + network::addDefaultRoute($o->{netc}) unless $::testing; #res_init(); # reinit the resolver so DNS changes take affect } sub timeConfig {} sub servicesConfig {} +sub printerConfig {} sub setRootPassword($) { my ($o) = @_; @@ -231,7 +233,7 @@ sub createBootdisk($) { return if $::testing; - lilo::mkbootdisk($o->{prefix}, versionString(), "/dev/$dev"); + lilo::mkbootdisk($o->{prefix}, versionString(), $dev); $o->{mkbootdisk} = $dev; } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index ca46629a7..52bedcd81 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -35,7 +35,7 @@ sub chooseLanguage($) { sub selectInstallOrUpgrade($) { my ($o) = @_; $o->ask_from_list_(_("Install/Upgrade"), - _("Is it an install or an upgrade?"), + _("Is this an install or an upgrade?"), [ __("Install"), __("Upgrade") ], $o->default("isUpgrade") ? "Upgrade" : "Install") eq "Upgrade"; } @@ -124,7 +124,7 @@ sub configureNetwork($) { } if ($r !~ /^Keep/) { - my @l = first(network::getNet()); + my @l = network::getNet() or return die _("no network card found"); @l = ($l[0]) unless $::expert; # keep only one $o->configureNetworkIntf(network::findIntf($o->{intf}, $_)) foreach @l; @@ -157,7 +157,7 @@ _("Choose the floppy drive you want to use to make the bootdisk"), \@l, $o->default("mkbootdisk")); } - $o->ask_warn('', _("Insert a floppy in floppy drive %s", $o->{mkbootdisk})); + $o->ask_warn('', _("Insert a floppy in drive %s", $o->{mkbootdisk})); my $w = $o->wait_message('', _("Creating bootdisk")); $o->SUPER::createBootdisk; } diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 94456e9c0..47e978229 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -12,12 +12,12 @@ use my_gtk qw(:helpers :wrappers); 1; -# redefine ask_warn -sub ask_warn { - my $o = shift; - local $my_gtk::grab = 1; - $o->SUPER::ask_warn(@_); -} +## redefine ask_warn +#sub ask_warn { +# my $o = shift; +# local $my_gtk::grab = 1; +# $o->SUPER::ask_warn(@_); +#} sub ask_from_entryW { my ($o, $title, $messages, $def) = @_; diff --git a/perl-install/interactive_stdio.pm b/perl-install/interactive_stdio.pm index 6fb1fd58c..f77cc082f 100644 --- a/perl-install/interactive_stdio.pm +++ b/perl-install/interactive_stdio.pm @@ -31,7 +31,7 @@ sub ask_from_listW { my @l; do { if (defined $i) { - @l ? print _("Ambiguity (%s) be more precise\n", join(", ", @l)) : + @l ? print _("Ambiguity (%s), be more precise\n", join(", ", @l)) : print _("Bad choice, try again\n"); } @$list == 1 ? print @$list : diff --git a/perl-install/lang.pm b/perl-install/lang.pm index f6cf56986..6a73c6a0a 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -164,5 +164,5 @@ sub load_font { # X11 font log::l("fontset: " . $fontSet); - Gtk::Gdk::Font::fontset_load("*",$fontSet); +# Gtk::Gdk::Font::fontset_load("*",$fontSet); } diff --git a/perl-install/modules.pm b/perl-install/modules.pm index e1e735e1b..4118fec29 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -231,11 +231,7 @@ sub load_raw($$$@) { my ($name, $type, $minor, @options) = @_; # @options or @options = guiGetModuleOptions($name); - my $f = "/tmp/$name.o"; - run_program::run("cd /tmp ; bzip2 -cd /lib/modules.cpio.bz2 | cpio -i $name.o"); - -r $f or die "can't find module $name"; - run_program::run("insmod", $f, @options) or die("insmod $name failed"); - unlink $f; + run_program::run("insmod", $name, @options) or die("insmod $name failed"); # this is a hack to make plip go if ($name eq "parport_pc") { @@ -250,6 +246,13 @@ sub load_raw($$$@) { $loaded{$name} = { type => $type, minor => $minor, options => \@options }; } +sub read_already_loaded() { + foreach (cat_("/proc/modules", "die")) { + my ($name) = split; + @{$loaded{$name}}{"type", "minor"} = @{$drivers{$name}}[3,4]; + } +} + sub load_deps($) { my ($file) = @_; diff --git a/perl-install/network.pm b/perl-install/network.pm index 7dd3f9349..f37012892 100644 --- a/perl-install/network.pm +++ b/perl-install/network.pm @@ -120,7 +120,12 @@ sub guessHostname { sub addDefaultRoute { my ($netc) = @_; - c::addDefaultRoute($netc->{gateway}) if $netc->{gateway} || !$::testing; + c::addDefaultRoute($netc->{GATEWAY}) if $netc->{GATEWAY}; +} + +sub sethostname { + my ($netc) = @_; + syscall_('sethostname', $netc->{HOSTNAME}, length $netc->{HOSTNAME}) or log::l("sethostname failed: $!"); } sub dnsServers { @@ -129,12 +134,8 @@ sub dnsServers { } sub getNet() { - my @l = detect_devices::getNet(); - unless (@l) { - modules::load_thiskind('net') or return; - @l = detect_devices::getNet(); - } - @l; + modules::load_thiskind('net'); + detect_devices::getNet(); } sub findIntf { diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm index 7d74debb5..ff54ef765 100644 --- a/perl-install/partition_table_raw.pm +++ b/perl-install/partition_table_raw.pm @@ -101,7 +101,7 @@ sub write($$$) { sub clear_raw { { raw => [ ({}) x $nb_primary ] } } -sub zero_MBR($) { +sub zero_MBR($) { my ($hd) = @_; $hd->{isDirty} = $hd->{needKernelReread} = 1; $hd->{primary} = clear_raw(); diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 2a9947e60..3813cfcbc 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -248,7 +248,10 @@ sub install { log::ld("starting installation: ", $nb, " packages, ", $total, " bytes"); # !! do not translate these messages, they are used when catched (cf install_steps_graphical) - my $callbackOpen = sub { fileno install_any::getFile($_[0]) || log::l("bad file $_[0]") }; + my $callbackOpen = sub { + my $fd = install_any::getFile($_[0]) or log::l("bad file $_[0]"); + $fd ? fileno $fd : -1; + }; my $callbackClose = sub { }; my $callbackStart = sub { log::ld("starting installing package ", $_[0]) }; my $callbackProgress = sub { log::ld("progressing installation ", $_[0], "/", $_[1]) }; diff --git a/perl-install/share/install.rc b/perl-install/share/install.rc index d02ae6105..20dbbe915 100644 --- a/perl-install/share/install.rc +++ b/perl-install/share/install.rc @@ -1,8 +1,13 @@ +style "default-font" +{ + font = "-adobe-helvetica-medium-r-normal-*-*-100-*-*-p-*-iso8859-1" +} + style "steps" { bg[NORMAL] = { 0, 0, 0 } fg[NORMAL] = { 1.0, 1.0, 1.0 } - font = "-adobe-helvetica-medium-r-normal-*-*-80-*-*-p-*-iso8859-1" + font = "-adobe-helvetica-medium-r-normal-*-*-80-*-*-p-*-iso8859-1" } style "logo" @@ -30,5 +35,6 @@ style "logo" base[INSENSITIVE] = { 1.0, 1.0, 1.0 } } +widget "*" style "default-font" widget "*Steps*" style "steps" widget "*logo*" style "logo" diff --git a/perl-install/share/themes-blackwhite.rc b/perl-install/share/themes-blackwhite.rc index bc94df9aa..8635192fe 100644 --- a/perl-install/share/themes-blackwhite.rc +++ b/perl-install/share/themes-blackwhite.rc @@ -1,7 +1,5 @@ style "any" { - font = "-adobe-helvetica-medium-r-normal-*-*-100-*-*-p-*-iso8859-1" - bg[NORMAL] = { 0.67, 0.67, 0.67 } bg[ACTIVE] = { 0, 0, 0 } bg[PRELIGHT] = { 0, 0, 0 } diff --git a/perl-install/share/themes-blue.rc b/perl-install/share/themes-blue.rc index 1404d4dce..958be8d1a 100644 --- a/perl-install/share/themes-blue.rc +++ b/perl-install/share/themes-blue.rc @@ -1,7 +1,5 @@ style "any" { - font = "-adobe-helvetica-medium-r-normal-*-*-100-*-*-p-*-iso8859-1" - bg[NORMAL] = { 0, 0, 0.67 } bg[ACTIVE] = { 0, 0.67, 1.0 } bg[PRELIGHT] = { 0, 0, 1.0 } diff --git a/perl-install/share/themes-savane.rc b/perl-install/share/themes-savane.rc index dcc60633a..d96d79eae 100644 --- a/perl-install/share/themes-savane.rc +++ b/perl-install/share/themes-savane.rc @@ -1,7 +1,5 @@ style "any" { - font = "-adobe-helvetica-medium-r-normal-*-*-100-*-*-p-*-iso8859-1" - bg[NORMAL] = { 0.67, 0.33, 0 } bg[ACTIVE] = { 1.0, 0.67, 0 } bg[PRELIGHT] = { 1.0, 1.0, 0 } -- cgit v1.2.1