From 262903f3d6dc8c5b245ba4931a0f3cf55c6f915b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 18 Apr 2000 23:08:50 +0000 Subject: no_comment --- perl-install/any.pm | 8 +++++-- perl-install/fs.pm | 14 +++++------ perl-install/help.pm | 23 +++++++----------- perl-install/install_any.pm | 6 ++--- perl-install/install_steps.pm | 8 +------ perl-install/install_steps_gtk.pm | 40 +++++++++++++++++++++---------- perl-install/install_steps_interactive.pm | 18 +++++++------- perl-install/modules.pm | 2 +- perl-install/my_gtk.pm | 2 +- perl-install/standalone/drakboot | 11 +++++---- 10 files changed, 70 insertions(+), 62 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index a5dd80f64..bfd8fc9ad 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -7,7 +7,7 @@ use vars qw(@users); #-###################################################################################### #- misc imports #-###################################################################################### -use common qw(:common :system :file); +use common qw(:common :system :file :functional); use commands; use detect_devices; use fsedit; @@ -69,7 +69,11 @@ sub setupBootloader { } elsif ($more || !$::beginner) { $in->set_help("setupBootloaderGeneral") unless $::isStandalone; - $::expert and $in->ask_yesorno('', _("Do you want to use LILO?"), 1) || return; + my @m = keys %{$b->{methods}}; + $::expert and $in->ask_many_from_list_ref('', _("Which bootloader(s) do you want to use?"), + [ @m ], [ map { \$b->{methods}{$_} } @m ]) || return; + #- at least one method + grep_each { $::b } %{$b->{methods}} or return; my @l = ( _("Boot device") => { val => \$b->{boot}, list => [ map { "/dev/$_" } (map { $_->{device} } @$hds, @$fstab), detect_devices::floppies() ], not_edit => !$::expert }, diff --git a/perl-install/fs.pm b/perl-install/fs.pm index ed3bed4e1..2f502728f 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -349,7 +349,12 @@ sub write_fstab($;$$) { require fsedit; unshift @to_add, - map { + grep { + my $b = !exists $new{$_->[0]} && !exists $new{$_->[1]}; + #- keep in mind the new line for fstab. + @new{@$_[0,1]} = undef; + $b + } map { my ($dir, $options, $freq, $passno) = qw(/dev/ defaults 0 0); $options = $_->{options} || $options; @@ -371,16 +376,12 @@ sub write_fstab($;$$) { add_options($options, "loop") if isLoopback($_) && !isSwap($_); #- no need for loop option for swap files - #- keep in mind the new line for fstab. - @new{($_->{mntpoint}, $dev)} = undef; - eval { devices::make("$prefix/$dev") } if $dir && !isLoopback($_); mkdir "$prefix/$_->{mntpoint}", 0755 if $_->{mntpoint} && !isSwap($_); [ $dev, $_->{mntpoint}, type2fs($_->{type}), $options, $freq, $passno ]; - } grep { $_->{mntpoint} && type2fs($_->{type}) && - ! exists $new{$_->{mntpoint}} && ! exists $new{"/dev/$_->{device}"} } @$fstab; + } grep { $_->{mntpoint} && type2fs($_->{type}) } @$fstab; push @to_add, grep { !exists $new{$_->[0]} && !exists $new{$_->[1]} } @@ -390,7 +391,6 @@ sub write_fstab($;$$) { local *F; open F, "> $prefix/etc/fstab" or die "error writing $prefix/etc/fstab"; print F join(" ", @$_), "\n" foreach sort { $a->[1] cmp $b->[1] } @to_add; - log::l("fstab: ", join(" ", @$_)) foreach sort { $a->[1] cmp $b->[1] } @to_add; } sub merge_fstabs { diff --git a/perl-install/help.pm b/perl-install/help.pm index d589500d8..4bc4b798b 100644 --- a/perl-install/help.pm +++ b/perl-install/help.pm @@ -123,20 +123,15 @@ partitions, particularly if they contain files or data you wish to keep. Typically retained are /home and /usr/local."), choosePackages => - __("You may now select the packages you wish to install. - - -First you can select group of package to install or upgrade. After that -you can select more packages according to the total size you wish to -select. - - -If you are in expert mode, you can select packages individually. -Please note that some packages require the installation of others. -These are referred to as package dependencies. The packages you select, -and the packages they require will be automatically selected for -install. It is impossible to install a package without installing all -of its dependencies."), + __("You may now select the group of packages you wish to +install or upgrade. + +DrakX will then check whether you have enough room to install them all. If not, +it will warn you about it. If you want to go on anyway, it will proceed onto +the installation of all selected groups but will drop some packages of lesser +interest. If you scroll down the bottom of the list and check the option +\"Select packages individually\", you will be able to do so, indeed, but you'll +have to browse through more than 1000 packages..."), doInstallStep => __("The packages selected are now being installed. This operation diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 531f5fe00..3af71804b 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -226,7 +226,7 @@ sub getAvailableSpace { do { $_->{mntpoint} eq '/' and return int($_->{size} * 512 / 1.07) } foreach @{$o->{fstab}}; if ($::testing) { - my $nb = 1350; + my $nb = 650; log::l("taking ${nb}MB for testing"); return $nb << 20; } @@ -499,7 +499,7 @@ sub setupFB { #- nothing done, fall through linux-fb. } else { $e->{vga} = $vga; - lilo::install($o->{prefix}, $o->{bootloader}); + lilo::install($o->{prefix}, $o->{bootloader}, $o->{fstab}, $o->{hds}); return 1; } } @@ -511,7 +511,7 @@ sub setupFB { vga => $vga, })) { $o->{bootloader}{default} = 'linux-fb'; - lilo::install($o->{prefix}, $o->{bootloader}); + lilo::install($o->{prefix}, $o->{bootloader}, $o->{fstab}, $o->{hds}); } else { log::l("unable to install kernel with frame buffer support, disabling"); return 0; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 9bb3bd26a..56f6087e5 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -741,14 +741,8 @@ sub setupBootloader($) { map { /$o->{prefix}(.*)/ } eval { glob_("$o->{prefix}/boot/vmlinux*") }; } elsif (arch() =~ /^sparc/) { silo::install($o->{prefix}, $o->{bootloader}); - } elsif ($o->{lnx4win}) { - local $o->{bootloader}{boot} = first(grep { loopback::carryRootLoopback($_) } @{$o->{fstab}}); - eval { lilo::install_loadlin($o->{prefix}, $o->{bootloader}, $o->{fstab}) }; } else { - eval { lilo::install($o->{prefix}, $o->{bootloader}, $o->{fstab}) }; - my $err = $@; - eval { lilo::install_grub($o->{prefix}, $o->{bootloader}, $o->{fstab}, $o->{hds}) }; - die $err if $@ && $err; + lilo::install($o->{prefix}, $o->{bootloader}, $o->{fstab}, $o->{hds}); } } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 79dafaddc..691af9a2e 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -175,7 +175,7 @@ sub selectMouse { $o->SUPER::selectMouse($force); my $dev = $o->{mouse}{device}; - if ($old_dev ne $dev && $dev =~ /ttyS/) { + if ($old_dev ne $dev && $dev =~ /ttyS/ && !$::testing) { log::l("telling X server to use another mouse"); eval { commands::modprobe("serial") }; symlinkf($dev, "/dev/mouse"); @@ -295,25 +295,39 @@ _("Choose the sizes"), #------------------------------------------------------------------------------ sub chooseSizeToInstall { - my ($o, $packages, $min_size, $max_size) = @_; + my ($o, $packages, $min_size, $max_size_, $available, $individual) = @_; + my $enough = $available > $max_size_; + my $max_size = min($max_size_, $available * 0.9); + my $percentage = int 100 * $max_size / $max_size_; + print "$min_size, $max_size_, $available, $max_size\n"; #- don't ask anything if the difference between min and max is too small - return $max_size if $min_size && $max_size / $min_size < 1.01; +# return $max_size if $min_size && $max_size / $min_size < 1.01; - my ($min, $max) = map { pkgs::correctSize($_ / sqr(1024)) } $min_size, $max_size; - log::l("choosing size to install between $min and $max (really between $min_size and $max_size)"); + log::l("choosing size to install between $min_size and $max_size"); my $w = my_gtk->new(''); - my $adj = create_adjustment($max, $min, $max); + my $adj = create_adjustment($percentage, $min_size * 100 / $max_size_, $percentage); my $spin = gtkset_usize(new Gtk::SpinButton($adj, 0, 0), 100, 0); + my $val; gtkadd($w->{window}, gtkpack(new Gtk::VBox(0,20), -_("Now that you've selected desired groups, please choose -how many packages you want, ranging from minimal to full -installation of each selected groups.") . - ($o->{compssUsersChoice}{Individual} ? "\n" . _("You will be able to choose them more specificaly in the next step") : ''), - create_packtable({ col_spacings => 10 }, - [ _("Choose the size you want to install"), $spin, _("MB"), ], + _("The total size for the groups you have selected is approximately %d MB.\n", pkgs::correctSize($max_size_ / sqr(1024))) . + ($enough ? +_("If you wish to install less than this size, +select the percentage of packages that you want to install. + +A low percentage will install only the most important packages; +a percentage of 100% will install all selected packages.") : +_("You have space on your disk for only %d%% of these packages. + +If you wish to install less than this, +select the percentage of packages that you want to install. +A low percentage will install only the most important packages; +a percentage of %d%% will install as many packages as possible.", $percentage + 1, $percentage + 1)) +. ($individual ? "\n\n" . _("You will be able to choose them more specifically in the next step.") : ''), + create_packtable({}, + [ _("Percentage of packages to install") . ' ', $spin, "%", ], [ undef, new Gtk::HScrollbar($adj) ], ), create_okcancel($w) @@ -321,7 +335,7 @@ installation of each selected groups.") . ); $spin->signal_connect(activate => sub { $w->{retval} = 1; Gtk->main_quit }); $spin->grab_focus(); - $w->main and pkgs::invCorrectSize($spin->get_value_as_int) * sqr(1024); + $w->main and $spin->get_value_as_int / 100 * $max_size; } sub choosePackagesTree { my ($o, $packages, $compss) = @_; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 4e2a9be74..7ceb35c08 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -281,16 +281,16 @@ sub choosePackages { my $min_mark = 1; my @l = values %{$packages->[0]}; my @flags = map { pkgs::packageFlagSelected($_) } @l; - pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $available, $o->{installClass}); + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, 0, $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; +#- 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, $max_size, $available, $individual) or goto &choosePackages; ($o->{packages_}{ind}) = pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $size2install, $o->{installClass}); @@ -299,8 +299,8 @@ You can go on anyway, but be warned that you won't get all packages", $max_size } sub chooseSizeToInstall { - my ($o, $packages, $min, $max) = @_; - install_any::getAvailableSpace($o) * 0.7; + my ($o, $packages, $min, $max, $available) = @_; + $available * 0.7; } sub choosePackagesTree {} diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 2a099d2dc..be81bb165 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -379,7 +379,7 @@ sub load { } else { $conf{$name}{loaded} and return; - $type ||= ($drivers{$name} || { type => 'unknown'})->{type}; +#- $type ||= ($drivers{$name} || { type => 'unknown'})->{type}; eval { load($_, 'prereq') } foreach @{$deps{$name}}; load_raw($name, @options); diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 65517c8a0..8fb641f87 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -204,7 +204,7 @@ sub create_box_with_title($@) { my $o = shift; my $nb_lines = map { split "\n" } @_; - $o->{box} = (@_ <= 2 && $nb_lines > 3) ? + $o->{box} = (@_ <= 2 && $nb_lines > 4) ? gtkpack(new Gtk::VBox(0,0), gtkset_usize(createScrolledWindow(gtktext_insert(new Gtk::Text, join "\n", @_)), 400, min(250, $nb_lines * 20))) : gtkpack_(new Gtk::VBox(0,0), diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index 33af4079a..6171c5a30 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -12,13 +12,16 @@ use c; local $_ = join '', @ARGV; -/-h/ and die "usage: drakboot\n"; +/-h/ and die "usage: drakboot [--expert]\n"; +$::expert = /-expert/; $::isStandalone = 1; my $in = vnew interactive('su'); my $bootloader = lilo::read('', '/etc/lilo.conf'); +local ($_) = `detectloader`; +$bootloader->{methods} = { lilo => 1, grub => !!/grub/i }; my $hds = catch_cdie { fsedit::hds([ detect_devices::hds() ], {}) } sub { 1 }; my $fstab = [ fsedit::get_fstab(@$hds) ]; @@ -27,11 +30,9 @@ fs::get_mntpoints_from_fstab($fstab); ask: any::setupBootloader($in, $bootloader, $hds, $fstab, $ENV{SECURE_LEVEL}) or $in->exit(0); -eval { lilo::install('', $bootloader) }; -my $err = $@; -eval { lilo::install_grub('', $bootloader, $fstab, $hds) }; +eval { lilo::install('', $bootloader, $fstab, $hds) }; -if ($err && $@) { +if ($@) { $in->ask_warn('', [ _("Installation of LILO failed. The following error occured:"), grep { !/^Warning:/ } cat_("/tmp/.error") ]); -- cgit v1.2.1