From 2ee22881483e84ea8b5ef0a5125631c04d174617 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 28 Nov 1999 19:14:45 +0000 Subject: no_comment --- docs/TODO | 20 +++++++--- perl-install/Xconfigurator.pm | 8 ++-- perl-install/c/stuff.pm | 1 + perl-install/c/stuff.xs.pm | 12 +----- perl-install/class_discard.pm | 7 ++++ perl-install/common.pm | 2 +- perl-install/crypto.pm | 41 +++++++++++++++++++ perl-install/ftp.pm | 64 +++++++++++++++++------------- perl-install/install2.pm | 61 ++++++++++++++-------------- perl-install/install_any.pm | 21 +++++----- perl-install/install_steps.pm | 60 +++++++++++++++++++++------- perl-install/install_steps_auto_install.pm | 6 +++ perl-install/install_steps_gtk.pm | 34 ++++++++++------ perl-install/install_steps_interactive.pm | 60 ++++++++++++++++++++-------- perl-install/lang.pm | 1 + perl-install/pkgs.pm | 29 ++++++-------- perl-install/printerdrake.pm | 1 + perl-install/share/compssList | 3 +- perl-install/share/list | 1 + 19 files changed, 284 insertions(+), 148 deletions(-) create mode 100644 perl-install/class_discard.pm create mode 100644 perl-install/crypto.pm diff --git a/docs/TODO b/docs/TODO index 7b36e3a8c..068af8802 100644 --- a/docs/TODO +++ b/docs/TODO @@ -1,4 +1,12 @@ -move security question before isntallation of packages +bug: CANON BJC 4X00 do not work with current rhs-printfilters +(work with magicfilters (debian)) +(should be handled by ghostscript BJC600's driver) + +bug: mouse freeze just before network configuration (mouse primax) + +urpmi: have the error log in stdout (like /mnt/nfs/... not available) + +see what can be done with nvram (50 bytes to save information) i18n @@ -8,8 +16,6 @@ diskdrake in text mode ability to add nfs/weird_fs entries in fstab -language support: only choose the right locales and upmark the packages requiring it - standalone applications for configuration (netdrake) is configureNetworkNet needed with dhcp/bootp? @@ -19,8 +25,6 @@ X configuration and bootloader in kickstart (pix)Tree -> CTree, ``all'' branch with all packages -install ssh - (fpons)verify the free space is big enough. (fpons)pb with dependencies ``missing'': icewm do not require XFree86 and so you can have icewm but no X server @@ -120,3 +124,9 @@ auto_partitions suggested partition tables must be better foreach installClass (done,pix) update the list of modules (in update_kernel) + +(done,pix) language support: only choose the right locales and upmark the packages requiring it + +(done,pix) move security question before isntallation of packages + +(done,pix) install ssh diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 7e9bdb8b6..626ccd7bb 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -263,8 +263,8 @@ sub testConfig($) { ($resolutions, $clocklines); } -sub testFinalConfig($;$) { - my ($o, $auto) = @_; +sub testFinalConfig($;$$) { + my ($o, $auto, $skiptest) = @_; $o->{monitor}{hsyncrange} && $o->{monitor}{vsyncrange} or $in->ask_warn('', _("Monitor not configured")), return; @@ -279,7 +279,7 @@ sub testFinalConfig($;$) { write_XF86Config($o, $::testing ? $tmpconfig : "$prefix/etc/X11/XF86Config"); - $o->{card}{server} eq 'FBDev' and return 1; #- avoid testing since untestable without reboot. + $skiptest || $o->{card}{server} eq 'FBDev' and return 1; #- avoid testing since untestable without reboot. $auto or $in->ask_yesorno(_("Test configuration"), _("Do you want to test the configuration?"), 1) @@ -750,7 +750,7 @@ sub main { } my $ok = resolutionsConfiguration($o, auto => $::auto, noauto => $::noauto); - $ok &&= testFinalConfig($o, $::auto) unless $::skiptest; + $ok &&= testFinalConfig($o, $::auto, $::skiptest); my $quit; until ($ok || $quit) { diff --git a/perl-install/c/stuff.pm b/perl-install/c/stuff.pm index ea0320225..daf5d8ef3 100644 --- a/perl-install/c/stuff.pm +++ b/perl-install/c/stuff.pm @@ -23,6 +23,7 @@ sub headerGetEntry { $q eq 'size' and return headerGetEntry_int($h, RPMTAG_SIZE()); $q eq 'filenames' and return headerGetEntry_string_list($h, RPMTAG_FILENAMES()); $q eq 'obsoletes' and return headerGetEntry_string_list($h, RPMTAG_OBSOLETES()); + $q eq 'requires' and return headerGetEntry_string_list($h, RPMTAG_REQUIRENAME()); } 1; diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 93a9e8ab3..831b0c1c1 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -65,16 +65,8 @@ Xtest(display) XSetCloseDownMode(d, RetainPermanent); XCloseDisplay(d); } - { - char *args[2]; - args[0] = d ? "false" : "true"; /* inverted on purpose! */ - args[1] = NULL; - execvp(args[0], args); - } - printf("***************** SHOUDNT GET THERE ***************\n"); - exit(d != NULL); + _exit(d != NULL); } - waitpid(pid, &RETVAL, 0); OUTPUT: RETVAL @@ -628,7 +620,7 @@ headerGetEntry_string_list(h, query) VT_ACTIVATE VT_WAITACTIVE VT_GETSTATE CDROM_LOCKDOOR CDROMEJECT ) ], ); -push @macros, [ qw(int RPMTAG_NAME RPMTAG_GROUP RPMTAG_SIZE RPMTAG_VERSION RPMTAG_SUMMARY RPMTAG_DESCRIPTION RPMTAG_RELEASE RPMTAG_ARCH RPMTAG_FILENAMES RPMTAG_OBSOLETES) ] +push @macros, [ qw(int RPMTAG_NAME RPMTAG_GROUP RPMTAG_SIZE RPMTAG_VERSION RPMTAG_SUMMARY RPMTAG_DESCRIPTION RPMTAG_RELEASE RPMTAG_ARCH RPMTAG_FILENAMES RPMTAG_OBSOLETES RPMTAG_REQUIRENAME) ] if $ENV{C_RPM}; $\= "\n"; diff --git a/perl-install/class_discard.pm b/perl-install/class_discard.pm new file mode 100644 index 000000000..5242e6e8e --- /dev/null +++ b/perl-install/class_discard.pm @@ -0,0 +1,7 @@ +package class_discard; + +sub new { bless {}, "class_discard" } + +sub AUTOLOAD { } + +1; diff --git a/perl-install/common.pm b/perl-install/common.pm index 148011f51..927b863f7 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -446,7 +446,7 @@ sub removeXiBSuffix($) { sub formatTime($) { my ($s, $m, $h) = gmtime($_[0]); - sprintf "%02d:%02d:%02d", $h, $m, $s; + sprintf "%02d:%02d:%02d", $h, $m, 10 * int (($s + 5) / 10); } diff --git a/perl-install/crypto.pm b/perl-install/crypto.pm new file mode 100644 index 000000000..b9c7046dd --- /dev/null +++ b/perl-install/crypto.pm @@ -0,0 +1,41 @@ +package crypto; + +use diagnostics; +use strict; + +use common qw(:common); +use log; +use ftp; + +my %mirrors = ( + "ftp.nectec.or.th" => [ "Thailand", "/pub/mirrors/Mandrake-crypto" ], + "ftp.tvd.be" => [ "Belgium", "/packages/mandrake-crypto" ], + "sunsite.mff.cuni.cz" => [ "Czech Republic", "/OS/Linux/Dist/Mandrake-crypto" ], + "ftp.uni-kl.de" => [ "Germany", "/pub/linux/mandrake/Mandrake-crypto" ], + "ftp.leo.org" => [ "Germany", "/pub/comp/os/unix/linux/Mandrake/Mandrake-crypto" ], + "sunsite.uio.no" => [ "Norway", "/pub/unix/Linux/Mandrake-crypto" ], + "ftp.sunet.se" => [ "Sweden", "/pub/Linux/distributions/mandrake-crypto" ], +); + +my %deps = ( + 'libcrypto.so.0' => 'openssl', + 'libssl.so.0' => 'openssl', + 'mod_sxnet.so' => 'mod_ssl-sxnet', +); + +sub require2package { $deps{$_[0]} || $_[0] } +sub mirror2text($) { $mirrors{$_[0]} && "$mirrors{$_[0]}[0] ($_[0])" } +sub mirrorstext() { map { mirror2text($_) } keys %mirrors } +sub text2mirror($) { first($_[0] =~ /\((.*)\)$/) } +sub ftp($) { ftp::new($_[0], "$mirrors{$_[0]}[1]/RPMS") } + +sub packages($) { ftp($_[0])->ls } + +sub get { + my ($mirror, $dir, @files) = @_; + foreach (@files) { + log::l("crypto: downloading $_"); + ftp($mirror)->get($_, "$dir/$_") + } + int @files; +} diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm index 6c498f2af..bfabc5abf 100644 --- a/perl-install/ftp.pm +++ b/perl-install/ftp.pm @@ -6,45 +6,53 @@ use install_any; use network; use log; -# non-rentrant!! - -my $retr; +my %hosts; 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| +sub fromEnv() { + # using URLPREFIX to find out information if kickstart + ($ENV{LOGIN}, $ENV{PASSWORD}, $ENV{HOST}, $ENV{PREFIX}) = + $ENV{URLPREFIX} =~ m| :// (?: ([^:]*) # login (?: :([^@]*))? # password @)? ([^/]*) # host /?(.*) # prefix - |x; - } - unless ($ENV{LOGIN}) { - $ENV{LOGIN} = 'anonymous'; - $ENV{PASSWORD} = 'mdkinst@test'; - } - - my $ftp = Net::FTP->new(network::resolv($ENV{HOST}), %options) or die ''; - $ftp->login($ENV{LOGIN}, $ENV{PASSWORD}) or die ''; - $ftp->binary; - - $ftp; + |x unless $ENV{HOST}; + + @ENV{qw(HOST PREFIX LOGIN PASSWORD)}; } +sub new { + my ($host, $prefix, $login, $password) = @_; + my @l = do { if ($hosts{$host}) { + @{$hosts{$host}}; + } else { + my %options = (Passive => 1); + $options{Firewall} = $ENV{PROXY} if $ENV{PROXY}; + $options{Port} = $ENV{PROXYPORT} if $ENV{PROXYPORT}; + unless ($login) { + $login = 'anonymous'; + $password = 'DrakX@vivelinuxabaszindozs'; + } + + my $ftp = Net::FTP->new(network::resolv($host), %options) or die ''; + $ftp->login($login, $password) or die ''; + $ftp->binary; + $ftp->cwd($prefix); + + my @l = ($ftp, \ (my $retr = undef)); + $hosts{$host} = \@l; + @l; + }}; + wantarray ? @l : $l[0]; +} sub getFile($) { - $ftp ||= new(); - $retr->close if $retr; - $retr = $ftp->retr($ENV{PREFIX} . "/" . install_any::relGetFile($_[0])); + my $f = shift; + my ($ftp, $retr) = new(@_ ? @_ : fromEnv); + $$retr->close if $$retr; + $$retr = $ftp->retr(install_any::relGetFile($f)); } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index ef3da4d85..83c30f8bc 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -33,32 +33,35 @@ use detect_devices; use modparm; use run_program; +use install_steps; + #-###################################################################################### #- Steps table #-###################################################################################### -my @installStepsFields = qw(text redoable onError beginnerHidden needs entered reachable toBeDone help next done); +my @installStepsFields = qw(text redoable onError hidden needs entered reachable toBeDone help next done); my @installSteps = ( - selectLanguage => [ __("Choose your language"), 1, 1, 0 ], - selectInstallClass => [ __("Select installation class"), 1, 1, 0 ], - setupSCSI => [ __("Setup SCSI"), 1, 0, 0 ], - selectPath => [ __("Choose install or upgrade"), 0, 0, 0, "selectInstallClass" ], - selectMouse => [ __("Configure mouse"), 1, 1, 1, "selectPath" ], - selectKeyboard => [ __("Choose your keyboard"), 1, 1, 0, "selectPath" ], - partitionDisks => [ __("Setup filesystems"), 1, 0, 0, "selectPath" ], - formatPartitions => [ __("Format partitions"), 1, -1, 0, "partitionDisks" ], - choosePackages => [ __("Choose packages to install"), 1, 1, 1, "selectPath" ], - doInstallStep => [ __("Install system"), 1, -1, 0, ["formatPartitions", "selectPath"] ], - miscellaneous => [ __("Miscellaneous"), 1, 1, 1 , "formatPartitions" ], - configureNetwork => [ __("Configure networking"), 1, 1, 1, "formatPartitions" ], - configureTimezone => [ __("Configure timezone"), 1, 1, 0, "doInstallStep" ], -#- configureServices => [ __("Configure services"), 0, 0, 0 ], - configurePrinter => [ __("Configure printer"), 1, 0, 0, "doInstallStep" ], - setRootPassword => [ __("Set root password"), 1, 1, 0, "formatPartitions" ], - addUser => [ __("Add a user"), 1, 1, 0, "doInstallStep" ], - createBootdisk => [ __("Create a bootdisk"), 1, 0, 0, "doInstallStep" ], - setupBootloader => [ __("Install bootloader"), 1, 1, 0, "doInstallStep" ], - configureX => [ __("Configure X"), 1, 0, 0, ["formatPartitions", "setupBootloader"] ], - exitInstall => [ __("Exit install"), 0, 0, 1 ], + selectLanguage => [ __("Choose your language"), 1, 1, '' ], + selectInstallClass => [ __("Select installation class"), 1, 1, '' ], + setupSCSI => [ __("Setup SCSI"), 1, 0, '' ], + selectPath => [ __("Choose install or upgrade"), 0, 0, '', "selectInstallClass" ], + selectMouse => [ __("Configure mouse"), 1, 1, 'beginner', "selectPath" ], + selectKeyboard => [ __("Choose your keyboard"), 1, 1, '', "selectPath" ], + miscellaneous => [ __("Miscellaneous"), 1, 1, 'beginner' ], + partitionDisks => [ __("Setup filesystems"), 1, 0, '', "selectPath" ], + formatPartitions => [ __("Format partitions"), 1, -1, '', "partitionDisks" ], + choosePackages => [ __("Choose packages to install"), 1, 1, 'beginner', "selectPath" ], + doInstallStep => [ __("Install system"), 1, -1, '', ["formatPartitions", "selectPath"] ], + configureNetwork => [ __("Configure networking"), 1, 1, 'beginner', "formatPartitions" ], + installCrypto => [ __("Cryptographic"), 1, 1, '!expert', "configureNetwork" ], + configureTimezone => [ __("Configure timezone"), 1, 1, '', "doInstallStep" ], +#- configureServices => [ __("Configure services"), 0, 0, '' ], + configurePrinter => [ __("Configure printer"), 1, 0, '', "doInstallStep" ], + setRootPassword => [ __("Set root password"), 1, 1, '', "formatPartitions" ], + addUser => [ __("Add a user"), 1, 1, '', "doInstallStep" ], + createBootdisk => [ __("Create a bootdisk"), 1, 0, '', "doInstallStep" ], + setupBootloader => [ __("Install bootloader"), 1, 1, '', "doInstallStep" ], + configureX => [ __("Configure X"), 1, 0, '', ["formatPartitions", "setupBootloader"] ], + exitInstall => [ __("Exit install"), 0, 0, 'beginner' ], ); my (%installSteps, %upgradeSteps, @orderedInstallSteps, @orderedUpgradeSteps); @@ -184,7 +187,7 @@ $o = $::o = { steps => \%installSteps, orderedSteps => \@orderedInstallSteps, - + crypto => { mirror => "leia" }, base => [ qw(basesystem sed initscripts console-tools mkbootdisk utempter ldconfig chkconfig ntsysv setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps grep gzip hdparm info initscripts isapnptools kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash ash setserial shadow-utils sh-utils stat sysklogd tar termcap textutils time tmpwatch util-linux vim-minimal vixie-cron which perl-base msec) ], #-GOLD base => [ qw(basesystem sed initscripts console-tools mkbootdisk anacron utempter ldconfig chkconfig ntsysv mktemp setup filesystem SysVinit bdflush crontabs dev e2fsprogs etcskel fileutils findutils getty_ps 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 ash setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time tmpwatch util-linux vim-minimal vixie-cron which cpio perl) ], @@ -357,11 +360,7 @@ sub doInstallStep { } #------------------------------------------------------------------------------ sub miscellaneous { - $o->{miscellaneous}{memsize} ||= $1 if first(cat_("/proc/cmdline")) =~ /mem=(\S+)/; $o->miscellaneous($_[0]); - addToBeDone { - install_any::fsck_option(); - } 'doInstallStep'; } #------------------------------------------------------------------------------ @@ -381,6 +380,9 @@ sub configureNetwork { $o->configureNetwork; } +#------------------------------------------------------------------------------ +sub installCrypto { $o->installCrypto } + #------------------------------------------------------------------------------ sub configureTimezone { my ($clicked) = @_; @@ -472,8 +474,9 @@ sub main { method => sub { $o->{method} = $v }, pcmcia => sub { $o->{pcmcia} = $v }, step => sub { $o->{steps}{first} = $v }, - expert => sub { $o->{installClass} = 'expert'; $::expert = 1 }, - beginner => sub { $o->{installClass} = 'normal'; $::beginner = 1 }, + expert => sub { $::expert = 1 }, + beginner => sub { $::beginner = 1 }, + class => sub { $o->{installClass} = $v }, lnx4win => sub { $o->{lnx4win} = 1 }, readonly => sub { $o->{partitioning}{readonly} = $v ne "0" }, display => sub { $o->{display} = $v }, diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 02752b381..185fa4780 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -118,17 +118,17 @@ sub setPackages($) { eval { $o->{packages} = pkgs::psUsingHdlist() } if $useHdlist; $o->{packages} = pkgs::psUsingDirectory() if !$useHdlist || $@; - $o->{packages}{$_}{selected} = 1 foreach @{$o->{default_packages} || []}; + push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs"; + push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock}; + push @{$o->{default_packages}}, "kernel-smp" if detect_devices::hasSMP(); + push @{$o->{default_packages}}, "kernel-pcmcia-cs" if $o->{pcmcia}; + push @{$o->{default_packages}}, "raidtools" if !is_empty_hash_ref($o->{raid}); pkgs::getDeps($o->{packages}); my $c; ($o->{compss}, $c) = pkgs::readCompss($o->{packages}); $o->{compssListLevels} = pkgs::readCompssList($o->{packages}, $c, $o->{lang}); $o->{compssUsers} = pkgs::readCompssUsers($o->{packages}, $o->{compss}); - push @{$o->{base}}, "kernel-smp" if detect_devices::hasSMP(); - push @{$o->{base}}, "kernel-pcmcia-cs" if $o->{pcmcia}; - push @{$o->{base}}, "raidtools" if !is_empty_hash_ref($o->{raid}); - push @{$o->{base}}, "nfs-utils-clients" if $o->{method} eq "nfs"; grep { !$o->{packages}{$_} && log::l("missing base package $_") } @{$o->{base}} and die "missing some base packages"; } else { @@ -142,10 +142,11 @@ sub setPackages($) { my $p = $o->{packages}{$_} or log::l("missing base package $_"), next; pkgs::select($o->{packages}, $p, 1); } foreach @{$o->{base}}; + do { + my $p = $o->{packages}{$_} or log::l("missing add-on package $_"), next; + pkgs::select($o->{packages}, $p); + } foreach @{$o->{default_packages}}; } - return if $::auto_install; - - ($o->{packages_}{ind}, $o->{packages_}{select_level}) = pkgs::setSelectedFromCompssList($o->{compssListLevels}, $o->{packages}, getAvailableSpace($o) * 0.7, $o->{installClass}, $o->{lang}, $o->{isUpgrade}); } sub selectPackagesToUpgrade($) { @@ -395,11 +396,11 @@ sub g_auto_install(;$) { my @fields = qw(mntpoint type size); $o->{partitions} = [ map { my %l; @l{@fields} = @$_{@fields}; \%l } grep { $_->{mntpoint} } @{$::o->{fstab}} ]; - exists $::o->{$_} and $o->{$_} = $::o->{$_} foreach qw(lang autoSCSI authentication printer mouse netc timezone superuser intf keyboard mkbootdisk base users installClass partitioning isUpgrade manualFstab nomouseprobe); #- TODO modules bootloader + exists $::o->{$_} and $o->{$_} = $::o->{$_} foreach qw(lang autoSCSI authentication printer mouse netc timezone superuser intf keyboard mkbootdisk base users installClass partitioning isUpgrade manualFstab nomouseprobe crypto); #- TODO modules bootloader if (my $card = $::o->{X}{card}) { $o->{X}{card}{$_} = $card->{$_} foreach qw(default_depth); - $o->{X}{card}{resolution_wanted} = join "x", @{$card->{depth}{$card->{default_depth}}[0]}; + $o->{X}{card}{resolution_wanted} ||= join "x", @{$card->{depth}{$card->{default_depth}}[0]} if $card->{depth}; } #- local $o->{partitioning}{clearall} = 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 509d2b9ab..0dcff61fd 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -6,7 +6,7 @@ use strict; #-###################################################################################### #- misc imports #-###################################################################################### -use common qw(:file :system :common); +use common qw(:file :system :common :functional); use install_any qw(:all); use partition_table qw(:types); use detect_devices; @@ -14,7 +14,9 @@ use timezone; use Xconfig; use Xconfigurator; use modules; +use class_discard; use run_program; +use crypto; use lilo; use lang; use raid; @@ -197,11 +199,6 @@ sub beforeInstallPackages { sub installPackages($$) { my ($o, $packages) = @_; - while (my ($k, $v) = each %{$o->{compssUsersChoice}}) { - $v or next; - pkgs::select($packages, $_) foreach @{$o->{compssUsers}{$k}}; - } - #- hack to ensure proper ordering for installation of packages. my @firstToInstall = qw(basesystem sed); my %firstInstalled; @@ -229,6 +226,16 @@ sub afterInstallPackages($) { $o->pcmciaConfig(); + #- miscellaneous + addToBeDone { + setVarsInSh("$o->{prefix}/etc/sysconfig/system", { + HDPARM => $o->{miscellaneous}{HDPARM}, + TYPE => $o->{installClass}, + SECURITY => $o->{security}, + }); + install_any::fsck_option(); + } 'doInstallStep'; + my $p = $o->{packages}{urpmi}; install_any::install_urpmi($o->{prefix}, $o->{method}) if $p && $p->{selected}; } @@ -308,14 +315,40 @@ sub pppConfig { miscellaneousNetwork($o); } +#------------------------------------------------------------------------------ +sub installCrypto { + my ($o) = @_; + my $u = $o->{crypto} or return; $u->{mirror} or return; + my ($packages, %done); + my $dir = "$o->{prefix}/tmp"; + + local *install_any::getFile = sub { + local *F; + open F, "$dir/$_[0]" or return; + *F; + }; + while (crypto::get($u->{mirror}, $dir, + grep { !$done{$_} && ($done{$_} = $u->{packages}{$_}) } %{$u->{packages}})) { + $packages = pkgs::psUsingDirectory($dir); + foreach (values %$packages) { + foreach (c::headerGetEntry(pkgs::getHeader($_), 'requires')) { + my $r = crypto::require2package($_); + /^$r-\d/ and $u->{packages}{$_} = 1 foreach keys %{$u->{packages}}; + } + } + } + foreach (values %$packages) { + } + pkgs::install($o->{prefix}, [ values %$packages ]); +} + #------------------------------------------------------------------------------ sub pcmciaConfig($) { my ($o) = @_; my $t = $o->{pcmcia}; - my $f = "$o->{prefix}/etc/sysconfig/pcmcia"; #- should be set after installing the package above else the file will be renamed. - setVarsInSh($f, { + setVarsInSh("$o->{prefix}/etc/sysconfig/pcmcia", { PCMCIA => $t ? "yes" : "no", PCIC => $t, PCIC_OPTS => "", @@ -497,7 +530,7 @@ sub setupXfree { { local $::testing = 0; #- unset testing local $::auto = 1; local $::skiptest = 1; - Xconfigurator::main($o->{prefix}, $o->{X}, $o, $o->{allowFB}, sub { + Xconfigurator::main($o->{prefix}, $o->{X}, class_discard->new, $o->{allowFB}, sub { install_any::pkg_install($o, "XFree86-$_[0]"); }); } @@ -522,13 +555,10 @@ sub miscellaneousNetwork { #------------------------------------------------------------------------------ sub miscellaneous { my ($o) = @_; - setVarsInSh("$o->{prefix}/etc/sysconfig/system", { - LAPTOP => bool2text($o->{miscellaneous}{LAPTOP}), - HDPARM => $o->{miscellaneous}{HDPARM}, - TYPE => $o->{installClass}, - SECURITY => $o->{security}, - }); $ENV{SECURE_LEVEL} = $o->{security}; + + cat_("/proc/cmdline") =~ /mem=(\S+)/; + add2hash_($o->{miscellaneous} ||= {}, { numlock => !$o->{pcmcia}, $1 ? (memsize => $1 + 3) : () }); } #------------------------------------------------------------------------------ diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm index 4b2d9adcd..b6a17f2f9 100644 --- a/perl-install/install_steps_auto_install.pm +++ b/perl-install/install_steps_auto_install.pm @@ -31,4 +31,10 @@ sub errorInStep { c::_exit(0); } +sub exitInstall { + print "Auto installation complete\n"; + print "Press to reboot\n"; + ; +} + 1; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 79d2b1743..3c3f288c1 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -268,21 +268,26 @@ sub doPartitionDisks($$) { sub choosePackages { my ($o, $packages, $compss, $compssUsers, $first_time) = @_; - return if $::beginner; - chooseSizeToInstall(@_); - install_steps_interactive::choosePackages(@_) unless $::expert; - choosePackagesTree(@_) if $::expert; + if ($::beginner) { + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $o->{packages}, install_any::getAvailableSpace($o) * 0.7, $o->{installClass}, $o->{lang}, $o->{isUpgrade}); + } else { + install_steps_interactive::choosePackages(@_); + chooseSizeToInstall(@_); + choosePackagesTree(@_) if $::expert; + } } sub chooseSizeToInstall { my ($o, $packages, $compss, $compssUsers, $first_time) = @_; my $availableSpace = int(install_any::getAvailableSpace($o) / sqr(1024)); - my $default = pkgs::correctSize((sum map { $_->{size} } grep { $_->{selected} } values %$packages) / sqr(1024) || $availableSpace * 0.7); + my $current = pkgs::correctSize((sum map { $_->{size} } grep { $_->{selected} } values %$packages) / sqr(1024)); my $w = my_gtk->new(''); - my $adj = create_adjustment($default, 75, $availableSpace); + my $adj = create_adjustment($current * 1.3, $current, $availableSpace); my $spin = gtkset_usize(new Gtk::SpinButton($adj, 0, 0), 100, 0); gtkadd($w->{window}, gtkpack(new Gtk::VBox(0,20), + _("Going to install %d MB. You can choose to install more programs", $current) . + ($::expert ? "\n" . _("You will be able to choose more precisely in next step") : ''), create_packtable({ col_spacings => 10 }, [ _("Choose the size you want to install"), $spin, _("MB"), ], [ undef, new Gtk::HScrollbar($adj) ], @@ -294,8 +299,10 @@ sub chooseSizeToInstall { $spin->grab_focus(); $w->main or return; - $_->{selected} = 0 foreach values %$packages; - pkgs::setSelectedFromCompssList($o->{compssListLevels}, $o->{packages}, pkgs::invCorrectSize($spin->get_value_as_int) * sqr(1024), $o->{installClass}, $o->{lang}, $o->{isUpgrade}); + ($o->{packages_}{ind}, $o->{packages_}{select_level}) = + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $o->{packages}, + pkgs::invCorrectSize($spin->get_value_as_int) * sqr(1024), + $o->{installClass}, $o->{lang}, $o->{isUpgrade}); } sub choosePackagesTree { my ($o, $packages, $compss, $compssUsers) = @_; @@ -492,7 +499,7 @@ sub installPackages { my $w = my_gtk->new(_("Installing"), grab => 1); $w->{window}->set_usize($windowwidth * 0.8, $windowheight * 0.5); my $text = new Gtk::Label; - my ($msg, $msg_time_remaining, $msg_time_total) = map { new Gtk::Label } (1..3); + my ($msg, $msg_time_remaining, $msg_time_total) = map { new Gtk::Label } '', (_("Estimating")) x 2; my ($progress, $progress_total) = map { new Gtk::ProgressBar } (1..2); gtkadd($w->{window}, gtkadd(new Gtk::EventBox, gtkpack(new Gtk::VBox(0,10), @@ -514,7 +521,7 @@ sub installPackages { $nb = $_[0]; $total_size = $_[1]; $current_total_size = 0; $start_time = time(); - $msg->set(_("%d packages", $nb) . _(", %U bytes", $total_size)); + $msg->set(_("%d packages", $nb) . _(", %U MB", $total_size / 1024 / 1024)); $w->flush; } elsif ($m =~ /^Starting installing package/) { $progress->update(0); @@ -532,7 +539,7 @@ sub installPackages { my $total_time = $ratio ? $dtime / $ratio : time(); $progress_total->update($ratio); - if ($dtime != $last_dtime) { + if ($dtime != $last_dtime && $current_total_size > 2 * 1024 * 1024) { $msg_time_total->set(formatTime($total_time)); $msg_time_remaining->set(formatTime(max($total_time - $dtime, 0))); $last_dtime = $dtime; @@ -686,7 +693,10 @@ sub create_steps_window { $reachableSteps{$_} = $b if $step->{reachable}; $b; - } grep { !(($::beginner || !$o->{installClass}) && $o->{steps}{$_}{beginnerHidden}) } @{$o->{orderedSteps}}), + } grep { + local $_ = $o->{steps}{$_}{hidden}; + /^$/ or $o->{installClass} and /beginner/ && !$::beginner || /!expert/ && $::expert + } @{$o->{orderedSteps}}), 0, gtkpack(new Gtk::HBox(0,0), map { my $t = $_; my $w = new Gtk::Button(''); diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 4b6d3dc74..e26530631 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -3,7 +3,7 @@ package install_steps_interactive; use diagnostics; use strict; -use vars qw(@ISA); +use vars qw(@ISA $global_wait); @ISA = qw(install_steps); @@ -23,6 +23,7 @@ use run_program; use commands; use fsedit; use network; +use crypto; use raid; use mouse; use modules; @@ -235,13 +236,16 @@ sub selectPackagesToUpgrade { #------------------------------------------------------------------------------ sub choosePackages { my ($o, $packages, $compss, $compssUsers) = @_; - my %s; $o->ask_many_from_list_ref('', _("Package Group Selection"), [ keys %$compssUsers ], [ map { \$o->{compssUsersChoice}{$_} } keys %$compssUsers ] ); + while (my ($k, $v) = each %{$o->{compssUsersChoice}}) { + $v or next; + pkgs::select($packages, $_) foreach @{$o->{compssUsers}{$k}}; + } } #------------------------------------------------------------------------------ @@ -405,6 +409,30 @@ _("Second DNS Server") => \$m->{dns2}, $o->miscellaneousNetwork(); } +#------------------------------------------------------------------------------ +sub installCrypto { + my ($o) = @_; + my $u = $o->{crypto} ||= {}; + $::expert && $o->{intf} && $o->{netc}{NETWORKING} ne 'false' or return; + + is_empty_hash_ref($u) and $o->ask_yesorno('', +"Do you want to download cryptographic packages? +(! !) + ") || return; + + $u->{mirror} = crypto::text2mirror($o->ask_from_list('', _("Choose a mirror from which to get the packages"), [ crypto::mirrorstext ], crypto::mirror2text($u->{mirror}))); + + my @packages = do { + my $w = $o->wait_message('', _("Contacting the mirror to get the list of available packages")); + crypto::packages($u->{mirror}); + }; + + $o->ask_many_from_list_ref('', _("Which packages do you want to install"), \@packages, [ map { \$u->{packages}{$_} } @packages ]) or return; + + my $w = $o->wait_message('', _("Downloading cryptographic packages")); + install_steps::installCrypto($o); +} + #------------------------------------------------------------------------------ sub timeConfig { my ($o, $f, $clicked) = @_; @@ -706,30 +734,26 @@ sub miscellaneous { ); delete @l{0,1,5} unless $::expert; + install_steps::miscellaneous($o); my $u = $o->{miscellaneous} ||= {}; exists $u->{LAPTOP} or $u->{LAPTOP} = 1; my $s = $o->{security}; $s = $l{$s} || $s; - !$::beginner || $clicked and $o->ask_from_entries_ref('', - _("Miscellaneous questions"), - [ _("Is this machine a laptop?"), - _("Use hard drive optimisations?"), - _("Choose security level"), - _("Precise RAM size if needed (found %d MB)", availableRam / 1024 + 3), #- add three for correction. - ], - [ { val => \$u->{LAPTOP}, type => 'bool' }, - { val => \$u->{HDPARM}, type => 'bool', text => _("(may cause data corruption)") }, - { val => \$s, list => [ map { $l{$_} } ikeys %l ], not_edit => 1 }, - \$u->{memsize}, - ], - complete => sub { + !$::beginner || $clicked and $o->ask_from_entries_refH('', + _("Miscellaneous questions"), [ +_("Use hard drive optimisations?") => { val => \$u->{HDPARM}, type => 'bool', text => _("(may cause data corruption)") }, +_("Choose security level") => { val => \$s, list => [ map { $l{$_} } ikeys %l ], not_edit => 1 }, +_("Precise RAM size if needed (found %d MB)", availableRam / 1024 + 3) => \$u->{memsize}, #- add three for correction. + $u->{numlock} ? ( +_("Enable num lock at startup") => { val => \$u->{numlock}, type => 'bool' }, + ) : (), + ], complete => sub { !$u->{memsize} || $u->{memsize} =~ s/^(\d+)M?$/$1M/i or $o->ask_warn('', _("Give the ram size in Mb")), return 1; 0; } ) || return; - my %m = reverse %l; $o->{security} = $m{$s}; - install_steps::miscellaneous($o); + my %m = reverse %l; $ENV{SECURE_LEVEL} = $o->{security} = $m{$s}; } #------------------------------------------------------------------------------ @@ -780,6 +804,8 @@ consult the Errata available from http://www.linux-mandrake.com/. Information on configuring your system is available in the post install chapter of the Official Linux-Mandrake User's Guide.")) if $alldone && !$::g_auto_install; + $global_wait = $o->wait_message('', _("Shutting down")); + $o->SUPER::exitInstall; } diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 7853789ca..98e2839b7 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -175,6 +175,7 @@ sub load_po($) { $s .= "package po::I18N;\n"; $s .= "\%$lang = ("; + $lang = substr($lang, 0, 2); my $f; -e ($f = "$_/po/$lang.po") and last foreach @INC; unless (-e $f) { -e ($f = "$_") and last foreach @INC; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 3800e3979..b85be3b35 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -18,7 +18,8 @@ XFree86-P9000 XFree86-S3 XFree86-S3V XFree86-SVGA XFree86-W32 XFree86-I128 XFree86-Sun XFree86-SunMono XFree86-Sun24 XFree86-3DLabs kernel-BOOT MySQL MySQL_GPL mod_php3 midgard postfix metroess metrotmpl hackkernel hackkernel-BOOT hackkernel-fb hackkernel-headers -hackkernel-pcmcia-cs hackkernel-smp hackkernel-smp-fb autoirpm autoirpm-icons +hackkernel-pcmcia-cs hackkernel-smp hackkernel-smp-fb +autoirpm autoirpm-icons numlock ); my @preferred = qw( @@ -124,8 +125,8 @@ sub unselect_all($) { $_->{selected} = $_->{base} foreach values %$packages; } -sub psUsingDirectory() { - my $dirname = "/tmp/rhimage/Mandrake/RPMS"; +sub psUsingDirectory(;$) { + my $dirname = $_[0] || "/tmp/rhimage/Mandrake/RPMS"; my %packages; log::l("scanning $dirname for packages"); @@ -216,15 +217,6 @@ sub readCompss($) { sub readCompssList($$$) { my ($packages, $compss_, $lang) = @_; - my ($r, $s) = ('', ''); - if ($lang) { - local $SIG{__DIE__} = 'none'; - my ($l) = split ' ', lang::lang2text($lang); - $r = "($lang"; - $r .= "|$1" if $lang =~ /(..)./; - $r .= "|$l" if $l; - $r .= ")"; - } my $f = install_any::getFile("compssList") or die "can't find compssList"; local $_ = <$f>; my $level = [ split ]; @@ -233,17 +225,22 @@ sub readCompssList($$$) { foreach (<$f>) { /^\s*$/ || /^#/ and next; - /^packages\s*$/ and do { $e = $packages; $s = '-'; next }; - /^categories\s*$/ and do { $e = $compss_; $s = ':'; next }; + /^packages\s*$/ and do { $e = $packages; next }; + /^categories\s*$/ and do { $e = $compss_; next }; my ($name, @values) = split; $e or log::l("neither packages nor categories"); my $p = $e->{$name} or log::l("unknown entry $name (in compssList)"), next; - - @values = map { $_ + 68 } @values if $name =~ /$s$r$/i; $p->{values} = \@values; } + my $locales = "locales-" . substr($lang, 0, 2); + if (my $p = $packages->{$locales}) { + foreach ($locales, @{$p->{provides} || []}) { + my $p = $packages->{$_} or next; + $p->{values} = [ map { $_ + 70 } @{$p->{values}} ]; + } + } $level; } diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 28bcd3b1e..c41d1b0b0 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -8,6 +8,7 @@ use detect_devices; use run_program; use commands; use modules; +use network; use log; use printer; diff --git a/perl-install/share/compssList b/perl-install/share/compssList index 10ea6164c..48e9ae654 100644 --- a/perl-install/share/compssList +++ b/perl-install/share/compssList @@ -499,8 +499,9 @@ ncurses 0 0 80 ncurses-devel 6 0 80 netcfg 82 82 82 netkit-base 82 99 82 -netscape-common 82 0 70 +netscape-common 0 0 0 netscape-communicator 90 0 73 +netscape-francais 19 0 22 netscape-navigator 60 0 54 newt 20 0 75 newt-devel 5 0 75 diff --git a/perl-install/share/list b/perl-install/share/list index 1b17c0b59..66887047d 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -58,6 +58,7 @@ /usr/lib/perl5/site_perl/5.005/i386-linux/Net/Cmd.pm /usr/lib/perl5/site_perl/5.005/i386-linux/Net/Config.pm /usr/lib/perl5/site_perl/5.005/i386-linux/Net/FTP.pm +/usr/lib/perl5/site_perl/5.005/i386-linux/Net/FTP/A.pm /usr/lib/perl5/site_perl/5.005/i386-linux/Net/FTP/I.pm /usr/lib/perl5/site_perl/5.005/i386-linux/Net/FTP/dataconn.pm /usr/lib/perl5/site_perl/5.005/i386-linux/Net/Netrc.pm -- cgit v1.2.1