From dddfb90059117e6dde52c09e79ba0c8672942b53 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 17 Apr 2000 15:42:29 +0000 Subject: no_comment --- docs/TODO | 4 +- perl-install/ChangeLog | 5 ++ perl-install/c/stuff.xs.pm | 1 + perl-install/commands.pm | 8 +-- perl-install/common.pm | 8 ++- perl-install/crypto.pm | 2 +- perl-install/devices.pm | 28 +++++--- perl-install/fs.pm | 11 ++- perl-install/help.pm | 112 +++++++++++++++++------------ perl-install/install2.pm | 14 ++-- perl-install/install_any.pm | 41 +++-------- perl-install/install_steps.pm | 89 ++++++++++++++++------- perl-install/install_steps_auto_install.pm | 2 +- perl-install/install_steps_gtk.pm | 12 ++-- perl-install/install_steps_interactive.pm | 97 +++++++++++-------------- perl-install/interactive.pm | 17 ++--- perl-install/interactive_gtk.pm | 37 +++++----- perl-install/interactive_newt.pm | 6 +- perl-install/pkgs.pm | 12 ++-- perl-install/run_program.pm | 4 +- perl-install/share/compssUsers | 65 ++++++----------- 21 files changed, 304 insertions(+), 271 deletions(-) diff --git a/docs/TODO b/docs/TODO index bd7cc376c..3e4fb77de 100644 --- a/docs/TODO +++ b/docs/TODO @@ -10,8 +10,6 @@ partition is Ok (fixme? allow primary partition inside extended one, but with warning on diskdrake startup, made them as warning ?). -features------------------------------------------------------------------------------- -chooseGroup with individual alone - handle NT (add entry for it in lilo, put it in fstab) (NEED 7.1) auto-install for corporate, very important (need consolidation). @@ -502,3 +500,5 @@ already hda1 with /boot/vmlinuz (done,pix)in 640x480 install box is to small (cuz of 'Cancel' button beeing added) +(done,pix)chooseGroup with individual alone + diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index ea01dc681..88a63d65e 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,8 @@ +2000-04-17 Pixel + + * lilo.pm (suggest): in failsafe, runlevel ASKRUNLEVEL (handled by + linuxconf) + 2000-04-14 Pixel * install_steps_interactive.pm (choosePartitionsToFormat): don't diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index e02e51766..5fd85c635 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -687,6 +687,7 @@ rpmRunTransactions(trans, callbackOpen, callbackClose, callbackMessage, force) } if (rpmRunTransactions(trans, rpmRunTransactions_callback, NULL, NULL, &probs, 0, force ? ~0 : ~RPMPROB_FILTER_DISKSPACE)) { int i; + printf("rpmRunTransactions finished, errors occured %d\n", probs->numProblems); fflush(stdout); EXTEND(SP, probs->numProblems); for (i = 0; i < probs->numProblems; i++) { PUSHs(sv_2mortal(newSVpv(rpmProblemString(probs->probs[i]), 0))); diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 0c49dd87a..c7f75a447 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -172,20 +172,18 @@ sub chown_ { sub mkswap { @_ == 1 or die "mkswap \n"; - - require 'swap.pm'; + require swap; swap::enable($_[0], 0); } sub swapon { @_ == 1 or die "swapon \n"; - - require 'swap.pm'; + require swap; swap::swapon($_[0]); } sub swapoff { @_ == 1 or die "swapoff \n"; - require 'swap.pm'; + require swap; swap::swapoff($_[0]); } diff --git a/perl-install/common.pm b/perl-install/common.pm index 01bbec0d8..4e368c058 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -7,7 +7,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int @ISA = qw(Exporter); %EXPORT_TAGS = ( common => [ qw(__ even odd arch min max sqr sum and_ or_ sign product bool invbool listlength bool2text bool2yesno text2bool to_int to_float ikeys member divide is_empty_array_ref is_empty_hash_ref add2hash add2hash_ set_new set_add round round_up round_down first second top uniq translate untranslate warp_text formatAlaTeX formatLines deref) ], - functional => [ qw(fold_left compose map_index grep_index map_each grep_each list2kv map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ], + functional => [ qw(fold_left compose map_index grep_index map_each grep_each list2kv map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie combine) ], file => [ qw(dirname basename touch all glob_ cat_ output symlinkf chop_ mode typeFromMagic expand_symlinks) ], system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ salt getVarsFromSh setVarsInSh setVarsInCsh substInFile availableRam availableMemory removeXiBSuffix template2file formatTime unix2dos setVirtual) ], constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE) ], @@ -162,6 +162,12 @@ sub grep_each(&%) { } sub list2kv(@) { [ grep_index { even($::i) } @_ ], [ grep_index { odd($::i) } @_ ] } +sub combine { + my $nb = shift; + my @l; while (my @m = splice(@_, 0, $nb)) { push @l, \@m } + @l; +} + #- pseudo-array-hash :) sub map_tab_hash(&$@) { my ($f, $fields, @tab_hash) = @_; diff --git a/perl-install/crypto.pm b/perl-install/crypto.pm index 9c1514954..2951c001c 100644 --- a/perl-install/crypto.pm +++ b/perl-install/crypto.pm @@ -57,7 +57,7 @@ sub getPackages($) { pkgs::getOtherDeps($packages, getDepslist($mirror)); #- produce an output suitable for visualization. - pkgs::packagesOfMedium($packages, "Crypto"); + map { pkgs::packageName($_) } pkgs::packagesOfMedium($packages, "Crypto"); } sub get { diff --git a/perl-install/devices.pm b/perl-install/devices.pm index c48bd3636..1a84d84ae 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -48,17 +48,9 @@ sub set_loop { } } -sub make($) { - local $_ = my $file = $_[0]; +sub entry { my ($type, $major, $minor); - - if (m,^(.*/(?:dev|tmp))/(.*),) { - $_ = $2; - } else { - -e $file or $file = "/tmp/$_"; - -e $file or $file = "/dev/$_"; - } - -e $file and return $file; #- assume nobody takes fun at creating files named as device + local ($_) = @_; if (/^sd(.)(\d{0,2})/) { $type = c::S_IFBLK(); @@ -122,6 +114,22 @@ sub make($) { "zero" => [ c::S_IFCHR(), 1, 5 ], }}{$_} or die "unknown device $_" }; } + ($type, $major, $minor); +} + + +sub make($) { + local $_ = my $file = $_[0]; + + if (m,^(.*/(?:dev|tmp))/(.*),) { + $_ = $2; + } else { + -e $file or $file = "/tmp/$_"; + -e $file or $file = "/dev/$_"; + } + -e $file and return $file; #- assume nobody takes fun at creating files named as device + + my ($type, $major, $minor) = entry($_); #- make a directory for this inode if needed. mkdir dirname($file), 0755; diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 36972a11b..485f24660 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -164,7 +164,14 @@ sub formatMount_all { foreach sort { isLoopback($a) ? 1 : -1 } grep { $_->{mntpoint} } @$fstab; #- ensure the link is there - loopback::carryRootCreateSymlink($_, $prefix) foreach @$fstab; + loopback::carryRootCreateSymlink($_, $prefix) foreach @$fstab; + + #- for fun :) + #- that way, when install exits via ctrl-c, it gives hand to partition + eval { + my ($type, $major, $minor) = devices::entry(fsedit::get_root($fstab)->{device}); + output "/proc/sys/kernel/real-root-dev", makedev($major, $minor); + }; } sub mount($$$;$) { @@ -388,7 +395,7 @@ sub write_fstab($;$$) { sub merge_fstabs { my ($fstab, $manualFstab) = @_; my %l; $l{$_->{device}} = $_ foreach @$manualFstab; - add2hash_($_, $l{$_->{device}} || next) foreach @$fstab; + %$_ = (%$_, %{$l{$_->{device}} || next}) foreach @$fstab; } #sub check_mount_all_fstab($;$) { diff --git a/perl-install/help.pm b/perl-install/help.pm index ebc58f0a8..95e53334b 100644 --- a/perl-install/help.pm +++ b/perl-install/help.pm @@ -14,27 +14,44 @@ selectPath => installed, or if you wish to use multiple distributions or versions. -Choose \"Upgrade\" if you wish to update a previous version of Mandrake -Linux: 5.1 (Venice), 5.2 (Leloo), 5.3 (Festen), 6.0 (Venus), 6.1 -(Helios) or Gold 2000."), +Choose \"Upgrade\" if you wish to update a previous version of Mandrake Linux: +5.1 (Venice), 5.2 (Leloo), 5.3 (Festen), 6.0 (Venus), 6.1 (Helios), Gold 2000 +or 7.0 (Air)."), selectInstallClass => __("Select: - - Recommended: If you have never installed Linux before. + - Recommended: If you have never installed Linux before, choose this. NOTE: + networking will not be configured during installation, use \"LinuxConf\" + to configure it after the install completes. + - Customized: If you are familiar enough with GNU/Linux, you may then choose + the primary usage for your machine. See below for details. - - Customized: If you are familiar with Linux, you will be able to -select the usage for the installed system between normal, development or -server. Choose \"Normal\" for a general purpose installation of your -computer. You may choose \"Development\" if you will be using the computer -primarily for software development, or choose \"Server\" if you wish to -install a general purpose server (for mail, printing...). + - Expert: This supposes that you are fluent with GNU/Linux and want to + perform a highly customized installation. As for a \"Customized\" + installation class, you will be able to select the usage for your system. + But please, please, DO NOT CHOOSE THIS UNLESS YOU KNOW WHAT YOU ARE DOING! +The different choices for your machine's usage (provided, hence, that you have +chosen either \"Custom\" or \"Expert\" as an installation class) are the +following: - - Expert: If you are fluent with GNU/Linux and want to perform -a highly customized installation, this Install Class is for you. You will -be able to select the usage of your installed system as for \"Customized\"."), + - Normal: choose this if you intend to use your machine primarily for + everyday use (office work, graphics manipulation and so on). Do not + expect any compiler, development utility et al. installed. + + - Development: as its name says. Choose this if you intend to use your + machine primarily for software development. You will then have a complete + collection of software installed in order to compile, debug and format + source code, or create software packages. + + - Server: choose this if the machine which you're installing Linux-Mandrake + on is intended to be used as a server. Either a file server (NFS or SMB), + a print server (Unix' lp (Line Printer) protocol or Windows style SMB + printing), an authentication server (NIS), a database server and so on. As + such, do not expect any gimmicks (KDE, GNOME...) to be installed. +"), setupSCSI => __("DrakX will attempt at first to look for one or more PCI @@ -211,11 +228,17 @@ configureTimezone => __("You can now select your timezone according to where you live. -Linux manages time in GMT or \"Greenwich Meridian Time\" and translates it +Linux manages time in GMT or \"Greenwich Mean Time\" and translates it in local time according to the time zone you have selected."), configureServices => - __("Help"), + __("You may now choose which services you want to see started at boot time. +When your mouse comes over an item, a small balloon help will popup which +describes the role of the service. + +Be especially careful in this step if you intend to use your machine as a +server: you will probably want not to start any services which you don't +want."), configurePrinter => __("Linux can deal with many types of printer. Each of these @@ -228,7 +251,7 @@ to put it first, eg: \"My Printer|lp\". The printer having \"lp\" in its name(s) will be the default printer. -If your printer is directly connected to your computer, select +If your printer is physically connected to your computer, select \"Local printer\". You will then have to tell which port your printer is connected to, and select the appropriate filter. @@ -258,7 +281,7 @@ this password carefully! Unauthorized use of the root account can be extremely dangerous to the integrity of the system and its data, and other systems connected to it. The password should be a mixture of alphanumeric characters and a least 8 characters long. It -should *never* be written down. Do not make the password too long or +should NEVER be written down. Do not make the password too long or complicated, though: you must be able to remember without too much effort."), @@ -305,7 +328,7 @@ drive (MBR)\"."), setupBootloader => __("Unless you know specifically otherwise, the usual choice is \"/dev/hda\" -(the master drive on the primary channel)."), + (primary master IDE disk) or \"/dev/sda\" (first SCSI disk)."), setupBootloaderAddEntry => __("LILO (the LInux LOader) can boot Linux and other operating systems. @@ -373,32 +396,33 @@ configureXxdm => \"No\"."), miscellaneous => - __("You can now select some miscellaneous options for you system. - - - Use hard drive optimizations: This option can improve hard disk -accesses but is only for advanced users, it can ruin your hard drive if -used incorrectly. Use it only if you know how. - - - - Choose security level: You can choose a security level for your -system. - Please refer to the manual for more information. - - - - Precise RAM size if needed: In some cases, Linux is unable to -correctly detect all the installed RAM on some systems. If this is the -case, specify the correct quantity. Note: a difference of 2 or 4 Mb is -normal. - - - - Removable media automounting: If you would prefer not to manually -mount removable drives (CD-ROM, Floppy, Zip) by typing \"mount\" and -\"umount\", select this option. - - - - Enable Num Lock at startup: If you want Number Lock enabled after -booting, select this option (Note: Num Lock will still not work under -X)."), + __("You can now select some miscellaneous options for your system. + + - Use hard drive optimizations: this option can improve hard disk performance + but is only for advanced users: some buggy chipsets can ruin your data, so + beware. Note that the kernel has a builtin blacklist of drives and + chipsets, but if you want to avoid bad surprises, leave this option unset. + + - Choose security level: you can choose a security level for your + system. Please refer to the manual for complete information. Basically: if + you don't know, select \"Medium\" ; if you really want to have a secure + machine, choose \"Paranoid\" but beware: IN THIS LEVEL, ROOT LOGIN AT + CONSOLE IS NOT ALLOWED! If you want to be root, you have to login as a user + and then use \"su\". More generally, do not expect to use your machine + for anything but as a server. You have been warned. + + - Precise RAM size if needed: unfortunately, in today's PC world, there is no + standard method to ask the BIOS about the amount of RAM present in your + computer. As a consequence, Linux may fail to detect your amount of RAM + correctly. If this is the case, you can specify the correct amount of RAM + here. Note that a difference of 2 or 4 MB is normal. + + - Removable media automounting: if you would prefer not to manually + mount removable media (CD-ROM, Floppy, Zip) by typing \"mount\" and + \"umount\", select this option. + + - Enable NumLock at startup: if you want NumLock enabled after booting, + select this option (Note: NumLock may or may not work under X)."), exitInstall => __("Your system is going to reboot. diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 152180a84..8bd94c67b 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -319,8 +319,6 @@ sub formatPartitions { unless ($o->{isUpgrade}) { $o->choosePartitionsToFormat($o->{fstab}); $o->formatMountPartitions($o->{fstab}) unless $::testing; - eval { $o = $::o = install_any::loadO($o) } if $_[1] == 1; - } mkdir "$o->{prefix}/$_", 0755 foreach qw(dev etc etc/profile.d etc/sysconfig etc/sysconfig/console etc/sysconfig/network-scripts @@ -371,7 +369,7 @@ sub doInstallStep { $o->readBootloaderConfigBeforeInstall if $_[1] == 1; $o->beforeInstallPackages; - $o->installPackages($o->{packages}); + $o->installPackages; $o->afterInstallPackages; } #------------------------------------------------------------------------------ @@ -387,9 +385,11 @@ sub miscellaneous { SECURITY => $o->{security}, }); - setVarsInSh("$o->{prefix}/etc/sysconfig/usb", { + my $f = "$o->{prefix}/etc/sysconfig/usb"; + setVarsInSh($f, { MOUSE => bool2yesno($o->{mouse}{device} eq "usbmouse"), - KEYBOARD => bool2yesno(int grep { /^keybdev\.c: Adding keyboard/ } detect_devices::syslog()), + KBD => bool2yesno(int grep { /^keybdev\.c: Adding keyboard/ } detect_devices::syslog()), + getVarsFromSh($f), }); install_any::fsck_option(); @@ -442,14 +442,14 @@ sub setRootPassword { return if $o->{isUpgrade}; $o->setRootPassword($_[0]); - addToBeDone { install_any::setAuthentication() } 'doInstallStep'; + addToBeDone { install_any::setAuthentication($o) } 'doInstallStep'; } #------------------------------------------------------------------------------ sub addUser { return if $o->{isUpgrade}; $o->addUser($_[0]); - install_any::setAuthentication(); + install_any::setAuthentication($o); } #------------------------------------------------------------------------------ diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 25a9a56c2..531f5fe00 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -254,7 +254,7 @@ sub setPackages($) { pkgs::getDeps($o->{packages}); $o->{compss} = pkgs::readCompss($o->{packages}); - $o->{compssListLevels} = pkgs::readCompssList($o->{packages}, $o->{compss}); + $o->{compssListLevels} = pkgs::readCompssList($o->{packages}); ($o->{compssUsers}, $o->{compssUsersSorted}) = pkgs::readCompssUsers($o->{packages}, $o->{compss}); my @l = (); @@ -272,15 +272,6 @@ sub setPackages($) { } else { pkgs::unselectAllPackages($o->{packages}); } - - #- this will be done if necessary in the selectPackagesToUpgrade, - #- move the selection here ? this will remove the little window. - unless ($o->{isUpgrade}) { - foreach (@{$o->{default_packages}}) { - my $p = pkgs::packageByName($o->{packages}, $_) or log::l("missing add-on package $_"), next; - pkgs::selectPackage($o->{packages}, $p); - } - } } sub selectPackagesToUpgrade($) { @@ -406,14 +397,15 @@ sub write_ldsoconf { } } -sub setAuthentication() { - my ($shadow, $md5, $nis, $nis_server) = @{$::o->{authentication} || {}}{qw(shadow md5 NIS NIS_server)}; - my $p = $::o->{prefix}; +sub setAuthentication { + my ($o) = @_; + my ($shadow, $md5, $nis, $nis_server) = @{$o->{authentication} || {}}{qw(shadow md5 NIS NIS_server)}; + my $p = $o->{prefix}; enableMD5Shadow($p, $shadow, $md5); enableShadow() if $shadow; if ($nis) { - pkg_install($::o, "ypbind"); - my $domain = $::o->{netc}{NISDOMAIN}; + $o->pkg_install("ypbind"); + my $domain = $o->{netc}{NISDOMAIN}; $domain || $nis_server ne "broadcast" or die _("Can't use broadcast with no NIS domain"); my $t = $domain ? "domain $domain" . ($nis_server ne "broadcast" && " server") : "ypserver"; @@ -421,7 +413,7 @@ sub setAuthentication() { $_ = "#~$_" unless /^#/; $_ .= "$t $nis_server\n" if eof; } "$p/etc/yp.conf"; - network::write_conf("$p/etc/sysconfig/network", $::o->{netc}); + network::write_conf("$p/etc/sysconfig/network", $o->{netc}); } } @@ -492,9 +484,7 @@ sub setupFB { my ($o, $vga) = @_; #- install needed packages for frame buffer. - require pkgs; - pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_)) foreach (qw(kernel-fb XFree86-FBDev)); - $o->installPackages($o->{packages}); + $o->installPackages(qw(kernel-fb XFree86-FBDev)); $vga ||= 785; #- assume at least 640x480x16. @@ -591,17 +581,6 @@ sub loadO { bless $o, ref $O; } -sub pkg_install { - my ($o, $name) = @_; - require pkgs; - require install_steps; - print "trying to pkg_install $name\n"; - pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $name) || die "$name rpm not found"); - print "trying to pkg_install $name : done selection\n"; - install_steps::installPackages($o, $o->{packages}); - print "trying to pkg_install $name : done installed\n"; -} - sub fsck_option() { my $y = $::o->{security} < 3 && $::beginner ? "-y " : ""; substInFile { s/^(\s*fsckoptions="?)(-y )?/$1$y/ } "$::o->{prefix}/etc/rc.d/rc.sysinit"; @@ -622,7 +601,7 @@ sub install_urpmi { hd => "file:/" . hdInstallPath(), ftp => $ENV{URLPREFIX}, http => $ENV{URLPREFIX}, - cdrom => "removable_cdrom_$::i://mnt/cdrom" }}{$method} . "/Mandrake/RPMS$_->{medium}"; + cdrom => "removable_cdrom_$::i://mnt/cdrom" }}{$method} . "/$_->{rpmsdir}"; local *FILES; open FILES, "bzip2 -dc /tmp/$_->{hdlist} 2>/dev/null | hdlist2names - |"; chop, print LIST "$dir/$_\n" foreach ; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 859bd58b3..7ca9537dc 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -130,12 +130,14 @@ sub doPartitionDisks { my $handle = loopback::inspect($real_part, '', 'rw') or die _("This partition can't be used for loopback"); my $size = loopback::getFree($handle->{dir}, $real_part); - my $max_linux = 1000 << 11; $max_linux *= 10 if $::expert; + my $max_linux = 250 << 11; $max_linux *= 10 if $::expert; + my $min_linux = 200 << 11; $max_linux /= 3 if $::expert; my $min_freewin = 100 << 11; my $swap = { type => 0x82, loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => 64 << 11, device => $real_part, notFormatted => 1 }; my $root = { type => 0x83, loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => 0, device => $real_part, notFormatted => 1 }; $root->{size} = min($size - $swap->{size} - $min_freewin, $max_linux); + $root->{size} > $min_linux or die "not enough room on that partition for lnx4win"; $o->doPartitionDisksLnx4winSize(\$root->{size}, \$swap->{size}, $size - 2 * $swap->{size}, 2 * $swap->{size}); @@ -214,8 +216,23 @@ sub selectPackagesToUpgrade { install_any::selectPackagesToUpgrade($o); } -sub choosePackages($$$$) { - my ($o, $packages, $compss, $compssUsers) = @_; +sub choosePackages { + my ($o, $packages, $compss, $compssUsers, $compssUsersSorted, $first_time) = @_; + + return if $o->{isUpgrade}; + + my $available = pkgs::invCorrectSize(install_any::getAvailableSpace($o) / sqr(1024)) * sqr(1024); + + foreach (values %{$packages->[0]}) { + pkgs::packageSetFlagSkip($_, 0); + pkgs::packageSetFlagUnskip($_, 0); + } + pkgs::unselectAllPackages($packages); + pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}}; + + add2hash_($o, { compssListLevel => $::expert ? 90 : 80 }); + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $o->{compssListLevel}, $available, $o->{installClass}); + $available; } sub beforeInstallPackages { @@ -241,8 +258,16 @@ sub beforeInstallPackages { pkgs::init_db($o->{prefix}, $o->{isUpgrade}); } +sub pkg_install { + my ($o, @l) = @_; + require pkgs; + pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || die "$_ rpm not found") foreach @l; + $o->installPackages; +} + sub installPackages($$) { #- complete REWORK, TODO and TOCHECK! - my ($o, $packages) = @_; + my ($o) = @_; + my $packages = $o->{packages}; if (@{$o->{toRemove} || []}) { #- hack to ensure proper upgrade of packages from other distribution, @@ -408,9 +433,9 @@ sub configureNetwork($) { network::sethostname($o->{netc}) unless $::testing; network::addDefaultRoute($o->{netc}) unless $::testing; - install_any::pkg_install($o, "dhcpxd") if grep { $_->{BOOTPROTO} =~ /^(dhcp|bootp)$/ } @{$o->{intf}}; + $o->pkg_install("dhcpxd") if grep { $_->{BOOTPROTO} =~ /^(dhcp|bootp)$/ } @{$o->{intf}}; # Handle also pump (this is still in initscripts no?) - install_any::pkg_install($o, "pump") if grep { $_->{BOOTPROTO} =~ /^(pump)$/ } @{$o->{intf}}; + $o->pkg_install("pump") if grep { $_->{BOOTPROTO} =~ /^(pump)$/ } @{$o->{intf}}; #-res_init(); #- reinit the resolver so DNS changes take affect miscellaneousNetwork($o); @@ -422,7 +447,7 @@ sub pppConfig { $o->{modem} or return; symlinkf($o->{modem}{device}, "$o->{prefix}/dev/modem") or log::l("creation of $o->{prefix}/dev/modem failed"); - install_any::pkg_install($o, "ppp"); + $o->pkg_install("ppp"); my %toreplace; $toreplace{$_} = $o->{modem}{$_} foreach qw(connection phone login passwd auth domain dns1 dns2); @@ -468,30 +493,26 @@ sub pppConfig { #------------------------------------------------------------------------------ sub installCrypto { my ($o) = @_; - my $u = $o->{crypto} or return; $u->{mirror} or return; - my ($packages, %done); - my $dir = "$o->{prefix}/tmp"; - modules::write_conf("$o->{prefix}/etc/conf.modules"); - network::up_it($o->{prefix}, $o->{intf}) if $o->{intf}; - - require pkgs; - foreach (values %{$u->{packages}}) { - pkgs::selectPackage($o->{packages}, $_->{pkg}) if $_->{selected}; - } + my $u = $o->{crypto} or return; $u->{mirror} && $u->{packages} or return; + $o->upNetwork; require crypto; + my @crypto_packages = crypto::getPackages($o->{prefix}, $o->{packages}, $u->{mirror}); + my $oldGetFile = \&install_any::getFile; local *install_any::getFile = sub { my ($rpmfile) = @_; - if ($rpmfile =~ /^(.*)-[^-]*-[^-]*$/) { - return crypto::getFile($rpmfile, $u->{mirror}) if $u->{packages}{$1}; + if ($rpmfile =~ /^(.*)-[^-]*-[^-]*$/ && member($1, @crypto_packages)) { + log::l("crypto::getFile $rpmfile"); + crypto::getFile($rpmfile, $u->{mirror}); + } else { + #- use previous getFile typically if non cryptographic packages + #- have been selected by dependancies. + log::l("normal getFile $rpmfile"); + &$oldGetFile($rpmfile); } - #- use previous getFile typically if non cryptographic packages - #- have been selected by dependancies. - &$oldGetFile($rpmfile); }; - - $o->installPackages($o->{packages}); + $o->pkg_install(@{$u->{packages}}); } #------------------------------------------------------------------------------ @@ -743,7 +764,7 @@ sub setupXfreeBefore { Xconfig::getinfoFromDDC($o->{X}); #- keep this here if the package has to be updated. - install_any::pkg_install($o, "XFree86"); + $o->pkg_install("XFree86"); } sub setupXfree { my ($o) = @_; @@ -755,7 +776,7 @@ sub setupXfree { local $::auto = 1; local $::skiptest = 1; Xconfigurator::main($o->{prefix}, $o->{X}, class_discard->new, $o->{allowFB}, bool($o->{pcmcia}), sub { - install_any::pkg_install($o, "XFree86-$_[0]"); + $o->pkg_install("XFree86-$_[0]"); }); } $o->setupXfreeAfter; @@ -820,6 +841,22 @@ sub generateAutoInstFloppy($) { my ($o) = @_; } +#------------------------------------------------------------------------------ +sub upNetwork { + my ($o) = @_; + + modules::write_conf("$o->{prefix}/etc/conf.modules"); + if ($o->{intf} && $o->{netc}{NETWORKING} ne 'false') { + network::up_it($o->{prefix}, $o->{intf}); + } elsif ($o->{modem} && !$o->{modem}{isUp}) { + run_program::rooted($o->{prefix}, "ifup", "ppp0"); + $o->{modem}{isUp} = 1; + } else { + $::testing or return; + } + 1; +} + #------------------------------------------------------------------------------ sub cleanIfFailedUpgrade($) { my ($o) = @_; diff --git a/perl-install/install_steps_auto_install.pm b/perl-install/install_steps_auto_install.pm index 3f7d6fc0a..a48154aea 100644 --- a/perl-install/install_steps_auto_install.pm +++ b/perl-install/install_steps_auto_install.pm @@ -15,7 +15,7 @@ use log; sub enteringStep($$$) { my ($o, $step) = @_; - print _("Entering step `%s'\n", $o->{steps}{$step}{text}); + print _("Entering step `%s'\n", translate($o->{steps}{$step}{text})); $o->SUPER::enteringStep($step); } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 651259c84..2c61db33b 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -122,7 +122,7 @@ sub new($$) { sub enteringStep { my ($o, $step) = @_; - print _("Entering step `%s'\n", $o->{steps}{$step}{text}); + print _("Entering step `%s'\n", translate($o->{steps}{$step}{text})); $o->SUPER::enteringStep($step); create_steps_window($o); create_help_window($o); @@ -189,9 +189,11 @@ sub doPartitionDisks { if ($o->{lnx4win}) { eval { install_steps::doPartitionDisks(@_) }; - $@ =~ /no fat/ or return; - - $o->ask_warn('', _("You don't have any windows partitions!")); + if ($@ =~ /no fat/) { + $o->ask_warn('', _("You don't have any windows partitions!")); + } elsif ($@ =~ /not enough room/) { + $o->ask_warn('', _("You don't have any enough room for Lnx4win")); + } else { return } delete $o->{lnx4win}; } if ($::beginner && fsedit::is_one_big_fat($hds)) { @@ -201,7 +203,7 @@ sub doPartitionDisks { my $min_freewin = 300 << 11; my ($part) = fsedit::get_fstab(@{$o->{hds}}); - my $w = $o->wait_message(_("Resizing"), _("Computing fat filesystem bounds")); + my $w = $o->wait_message(_("Resizing"), _("Computing FAT filesystem bounds")); my $resize_fat = eval { resize_fat::main->new($part->{device}, devices::make($part->{device})) }; $@ and goto diskdrake; my $min_win = $resize_fat->min_size; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index e48cc7d52..fd955d627 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -269,40 +269,33 @@ sub choosePackages { #- selection of CD by user if using a cdrom. $o->chooseCD($packages) if $o->{method} eq 'cdrom'; + my $available = install_steps::choosePackages(@_); + my $individual = $::expert; + require pkgs; unless ($o->{isUpgrade}) { - my $available = pkgs::invCorrectSize(install_any::getAvailableSpace($o) / sqr(1024)) * sqr(1024); - - foreach (values %{$packages->[0]}) { - pkgs::packageSetFlagSkip($_, 0); - pkgs::packageSetFlagUnskip($_, 0); - } - pkgs::unselectAllPackages($packages); - pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}}; - - pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $::expert ? 90 : 80, $available, $o->{installClass}); my $min_size = pkgs::selectedSize($packages); - $o->chooseGroups($packages, $compssUsers, $compssUsersSorted); + $o->chooseGroups($packages, $compssUsers, $compssUsersSorted, \$individual) unless $::beginner || $::corporate; my $min_mark = 1; - - my $ind = $o->{compssListLevels}{$o->{install_class}}; - my $max_size = int (sum map { pkgs::packageSize($_) } - grep { $_->{values}[$ind] >= $min_mark } values %{$packages->[0]}); - - if (!$::beginner && $max_size > $available) { - $o->ask_okcancel('', + my @l = values %{$packages->[0]}; + my @flags = map { pkgs::packageFlagSelected($_) } @l; + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $available, $o->{installClass}); + my $max_size = pkgs::selectedSize($packages); + mapn { pkgs::packageSetFlagSelected(@_) } \@l, \@flags; + + if (!$::beginner && $max_size > $available) { + $o->ask_okcancel('', _("You need %dMB for a full install of the groups you selected. You can go on anyway, but be warned that you won't get all packages", $max_size / sqr(1024)), 1) or goto &choosePackages - } - - my $size2install = $::beginner && $first_time ? $available * 0.7 : $o->chooseSizeToInstall($packages, $min_size, min($max_size, $available * 0.9)) or goto &choosePackages; + } + my $size2install = $::beginner && $first_time ? $available * 0.7 : $o->chooseSizeToInstall($packages, $min_size, min($max_size, $available * 0.9)) or goto &choosePackages; - ($o->{packages_}{ind}) = - pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $size2install, $o->{installClass}); + ($o->{packages_}{ind}) = + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $size2install, $o->{installClass}); } - $o->choosePackagesTree($packages, $compss) if $o->{compssUsersChoice}{Individual} || $::expert && $o->{isUpgrade}; + $o->choosePackagesTree($packages, $compss) if $individual; } sub chooseSizeToInstall { @@ -312,19 +305,19 @@ sub chooseSizeToInstall { sub choosePackagesTree {} sub chooseGroups { - my ($o, $packages, $compssUsers, $compssUsersSorted) = @_; + my ($o, $packages, $compssUsers, $compssUsersSorted, $individual) = @_; - add2hash_($o->{compssUsersChoice}, { Individual => $::expert }); $o->ask_many_from_list_ref('', _("Package Group Selection"), - [ @$compssUsersSorted, _("Miscellaneous"), _("Individual package selection") ], - [ map { \$o->{compssUsersChoice}{$_} } @$compssUsersSorted, "Miscellaneous", "Individual" ] - ) or goto &chooseGroups unless $::beginner || $::corporate; + [ @$compssUsersSorted, _("Miscellaneous") ], + [ map { \$o->{compssUsersChoice}{$_} } @$compssUsersSorted, "Miscellaneous" ], + [ _("Individual package selection") ], [ $individual ], + ) or goto &chooseGroups; unless ($o->{compssUsersChoice}{Miscellaneous}) { my %l; $l{@{$compssUsers->{$_}}} = () foreach @$compssUsersSorted; - exists $l{$_} or pkgs::packageSetFlagSkip(pkgs::packageByName($packages, $_), 1) foreach keys %$packages; + exists $l{$_} or pkgs::packageSetFlagSkip($_, 1) foreach values %{$packages->[0]}; } foreach (@$compssUsersSorted) { $o->{compssUsersChoice}{$_} or pkgs::skipSetWithProvides($packages, @{$compssUsers->{$_}}); @@ -332,8 +325,8 @@ sub chooseGroups { foreach (@$compssUsersSorted) { $o->{compssUsersChoice}{$_} or next; foreach (@{$compssUsers->{$_}}) { - $_->{unskip} = 1; - delete $_->{skip}; + pkgs::packageSetFlagUnskip($_, 1); + pkgs::packageSetFlagSkip($_, 0); } } } @@ -493,7 +486,7 @@ sub pppConfig { $m->{device} ||= $o->set_help('selectSerialPort') && mouse::serial_ports_names2dev( - $o->ask_from_list('', _("Please choose on which serial port your modem is connected to."), + $o->ask_from_list('', _("Please choose which serial port your modem is connected to."), [ mouse::serial_ports_names ])); $o->set_help('configureNetworkISP'); @@ -518,15 +511,7 @@ sub installCrypto { my $u = $o->{crypto} ||= {}; $::expert or return; - if ($o->{intf} && $o->{netc}{NETWORKING} ne 'false') { - my $w = $o->wait_message('', _("Bringing up the network")); - network::up_it($o->{prefix}, $o->{intf}); - } elsif ($o->{modem}) { - run_program::rooted($o->{prefix}, "ifup", "ppp0"); - } else { - $::testing or return; - } - + is_empty_hash_ref($u) and $o->ask_yesorno('', _("You have now the possibility to download software aimed for encryption. @@ -562,19 +547,17 @@ USA")) || return; $u->{mirror} = crypto::text2mirror($o->ask_from_list('', _("Choose a mirror from which to get the packages"), [ crypto::mirrorstext() ], crypto::mirror2text($u->{mirror}))); }; return if $@; - - my @packages = sort { pkgs::packageHeaderFile($a) cmp pkgs::packageHeaderFile($b) } do { + + $o->upNetwork; + + my @packages = do { my $w = $o->wait_message('', _("Contacting the mirror to get the list of available packages")); crypto::getPackages($o->{prefix}, $o->{packages}, $u->{mirror}); #- make sure $o->{packages} is defined when testing }; - - map { $u->{packages}{pkgs::packageName($_)} = { pkg => $_, selected => 0 } } @packages; - - $o->ask_many_from_list_ref('', _("Please choose the packages you want to install."), - [ map { pkgs::packageHeaderFile($_) } @packages ], - [ map { \$u->{packages}{pkgs::packageName($_)}{selected} } @packages ]) or return; - - my $w = $o->wait_message('', _("Downloading cryptographic packages")); + my %h; $h{$_} = 1 foreach @{$u->{packages} || []}; + $o->ask_many_from_list_ref('', _("Please choose the packages you want to install."), + \@packages, [ map { \$h{$_} } @packages ]) or return; + $u->{packages} = [ grep { $h{$_} } @packages ]; install_steps::installCrypto($o); } @@ -603,7 +586,7 @@ sub printerConfig { require printer; eval { add2hash($o->{printer} ||= {}, printer::getinfo($o->{prefix})) }; require printerdrake; - printerdrake::main($o->{printer}, $o, sub { install_any::pkg_install($o, $_[0]) }); + printerdrake::main($o->{printer}, $o, sub { $o->pkg_install($_[0]) }); } #------------------------------------------------------------------------------ @@ -983,7 +966,7 @@ sub setupXfree { $::noauto = $::noauto; #- no warning Xconfigurator::main($o->{prefix}, $o->{X}, $o, $o->{allowFB}, bool($o->{pcmcia}), sub { - install_any::pkg_install($o, "XFree86-$_[0]"); + $o->pkg_install("XFree86-$_[0]"); }); } $o->setupXfreeAfter; @@ -1169,6 +1152,12 @@ sub setup_thiskind { } } +sub upNetwork { + my ($o) = @_; + my $w = $o->wait_message('', _("Bringing up the network")); + install_steps::upNetwork($o); +} + #-###################################################################################### #- Wonderful perl :( diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index e09838d6b..b6beb96a4 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -155,20 +155,13 @@ sub ask_from_treelistW($$$$;$) { sub ask_many_from_list_ref { - my ($o, $title, $message, $l, $val) = @_; - return 1 if @$l == 0; - $o->ask_many_from_list_refW($title, [ deref($message) ], $l, $val); + my ($o, $title, $message, @l) = @_; + $o->ask_many_from_list_with_help_ref($title, [ deref($message) ], map { ($_->[0], [], $_->[1]) } combine(2, @l)); } sub ask_many_from_list_with_help_ref { - my ($o, $title, $message, $l, $help, $val) = @_; - return 1 if @$l == 0; - $o->ask_many_from_list_with_help_refW($title, [ deref($message) ], $l, $help, $val); -} - -#- defaults to without help -sub ask_many_from_list_with_help_refW { - my ($o, $title, $messages, $list, $help, $val) = @_; - $o->ask_many_from_list_refW($title, $messages, $list, $val); + my ($o, $title, $message, @l) = @_; + my @L = grep { $_->[0] } combine(3, @l) or return 1; + $o->ask_many_from_list_with_help_refW($title, [ deref($message) ], @L); } sub ask_many_from_list { diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 979220dd8..66a714221 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -147,32 +147,31 @@ sub ask_from_treelistW { $w->main or die "ask_from_list cancel"; } -sub ask_many_from_list_refW { - my ($o, $title, $messages, $list, $val) = @_; - ask_many_from_list_with_help_refW($o, $title, $messages, $list, undef, $val) -} - sub ask_many_from_list_with_help_refW { - my ($o, $title, $messages, $list, $help, $val) = @_; + my ($o, $title, $messages, @L) = @_; my $w = my_gtk->new('', %$o); my $tips = new Gtk::Tooltips; - my $box = gtkpack(new Gtk::VBox(0,0), - map_index { - my $i = $::i; - my $o = Gtk::CheckButton->new($_); - $tips->set_tip($o, $help->[$i]) if $help->[$i]; - $o->set_active(${$val->[$i]}); - $o->signal_connect(clicked => sub { invbool \${$val->[$i]} }); - $o; - } @$list); + my @boxes = map { + my $l = $_; + my $box = gtkpack(new Gtk::VBox(0,0), + map_index { + my $i = $::i; + my $o = Gtk::CheckButton->new($_); + $tips->set_tip($o, $l->[1][$i]) if $l->[1][$i]; + $o->set_active(${$l->[2][$i]}); + $o->signal_connect(clicked => sub { invbool $l->[2][$i] }); + $o; + } @{$l->[0]}); + @{$l->[0]} > 11 ? gtkset_usize(createScrolledWindow($box), 0, 250) : $box; + } @L; gtkadd($w->{window}, gtkpack_(create_box_with_title($w, @$messages), - 1, @$list > 11 ? gtkset_usize(createScrolledWindow($box), 0, 250) : $box, - 0, $w->create_okcancel, - ) + (map {; 1, $_ } @boxes), + 0, $w->create_okcancel, + ) ); $w->{ok}->grab_focus; - $w->main && $val; + $w->main; } sub ask_from_entries_refW { diff --git a/perl-install/interactive_newt.pm b/perl-install/interactive_newt.pm index 09163b07c..8f668c5e0 100644 --- a/perl-install/interactive_newt.pm +++ b/perl-install/interactive_newt.pm @@ -78,8 +78,10 @@ sub ask_from_listW { } } -sub ask_many_from_list_refW { - my ($o, $title, $messages, $list, $val) = @_; +sub ask_many_from_list_with_help_refW { + my ($o, $title, $messages, $lists) = @_; + my $list = map { $_->[0] } @$lists; + my $val = map { $_->[2] } @$lists; my $height = min(int @$list, 18); my $sb = Newt::Component::VerticalScrollbar(-1, -1, $height, 9, 10); diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index c5c4de8e8..df01f4ed1 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -314,7 +314,7 @@ sub unselectAllPackages($) { sub skipSetWithProvides { my ($packages, @l) = @_; - packageSetFlagSkip($_, 1) foreach grep { $_ } map { $_, packageProvides($_) } map { packageByName($packages, $_) } @l; + packageSetFlagSkip($_, 1) foreach grep { $_ } map { $_, packageProvides($_) } @l; } sub psUsingHdlists { @@ -537,7 +537,11 @@ sub readCompssList { sub readCompssUsers { my ($packages, $compss) = @_; my (%compssUsers, @sorted, $l); - my %compss; m|(.*)/(.*)| && push @{$compss{$1}}, $2 foreach @$compss; + my (%compss); + foreach (@$compss) { + local ($_, $a) = m|(.*)/(.*)|; + do { push @{$compss{$_}}, $a } while s|/[^/]+||; + } my $map = sub { $l or return; @@ -554,8 +558,7 @@ sub readCompssUsers { $compssUsers{$1} = $l = []; } elsif (/\s+\+(\S+)/) { push @$l, $1; - } elsif (/\s+(\S+)/) { - s|:|/|g; /\s+(\S+)/; + } elsif (/^\s+(.*?)\s*$/) { push @$l, @{$compss{$1} || log::l("unknown category $1 (in compssUsers)") && []}; } } @@ -934,6 +937,7 @@ sub install($$$;$$) { my @probs = c::rpmRunTransactions($trans, $callbackOpen, $callbackClose, \&installCallback, 0); log::l("rpmRunTransactions done"); + log::l("ERROR: rpmRunTransactions pb $_") foreach @probs; if (my @badpkgs = grep { !packageFlagInstalled($_) } @transToInstall) { cdie "error installing package list: " . join("\n", map { $_->{file} } @badpkgs), sub { diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm index e59286ea9..38fdbf8a9 100644 --- a/perl-install/run_program.pm +++ b/perl-install/run_program.pm @@ -33,12 +33,12 @@ sub rooted { $stderrm =~ s/2//; open STDERR, "$stderrm $root$stderr" or die "run_program can't output in $root$stderr (mode `$stderrm')"; } else { - open STDERR, ">> /dev/tty7" or open STDERR, ">> /tmp/exec.log" or die "run_program can't log :("; + open STDERR, ">> /dev/tty7" or open STDERR, ">> /tmp/exec.log" or die "run_program can't log, give me access to /tmp/exec.log"; } if ($stdout) { open STDOUT, "$stdoutm $root$stdout" or die "run_program can't output in $root$stdout (mode `$stdoutm')"; } else { - open STDOUT, ">> /dev/tty7" or open STDOUT, ">> /tmp/exec.log" or die "run_program can't log :("; + open STDOUT, ">> /dev/tty7" or open STDOUT, ">> /tmp/exec.log" or die "run_program can't log, give me access to /tmp/exec.log"; } $root and chroot $root; diff --git a/perl-install/share/compssUsers b/perl-install/share/compssUsers index 282a2ffe6..8b118756c 100644 --- a/perl-install/share/compssUsers +++ b/perl-install/share/compssUsers @@ -1,72 +1,51 @@ Graphics Manipulation - multimedia:graphic + Graphics KDE - kde + Graphical desktop/KDE +XFree86 +XFree86-75dpi-fonts +fonts-ttf-west_european Gnome - gnome - +enlightenment - +gmc + Graphical desktop/GNOME + Graphical desktop/Sawmill +XFree86 +XFree86-75dpi-fonts +fonts-ttf-west_european Other window managers - window-managers:window-managers + Graphical desktop/Window Maker + Graphical desktop/Enlightenment + Graphical desktop/FVWM based + Graphical desktop/Icewm + Graphical desktop/Other +XFree86 +XFree86-75dpi-fonts Mail/WWW/News Tools - network:web - network:mail - network:usenet + Networking/WWW + Networking/Mail + Networking/News Communication facilities - communications - network:ftp - network:irc&co + Communications + Networking/Chat + Networking/File transfer + Networking/IRC Office - daemons:database - finance - office - productivity + Office Multimedia Support - configuration:sound - multimedia:sound - multimedia:video - daemons:sound + Sound + Video Games - games - -System configuration - configuration:system - -Web Server - +apache - +mod_perl - +mod_php3 - -Network Management Workstation - network:tools -# above is daemons:network *without* sendmail and http - daemons:network:base - daemons:network:ftp - daemons:network:nfs - daemons:network:telnet -# +BeroList - +comsat - +postfix - +imap + Games Documentation - documentation + Books Databases - database + Databases -- cgit v1.2.1