summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps_interactive.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-01-04 14:17:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-01-04 14:17:15 +0000
commitf7bee8d26d4395332b6fdbf3722ae55c31e0238f (patch)
tree1ce4beb1715ca60f1fa22d45e5cc7b82d4aa3ad0 /perl-install/install_steps_interactive.pm
parenta8d2318343b50494f5d458ef89474ee5287f5302 (diff)
downloaddrakx-f7bee8d26d4395332b6fdbf3722ae55c31e0238f.tar
drakx-f7bee8d26d4395332b6fdbf3722ae55c31e0238f.tar.gz
drakx-f7bee8d26d4395332b6fdbf3722ae55c31e0238f.tar.bz2
drakx-f7bee8d26d4395332b6fdbf3722ae55c31e0238f.tar.xz
drakx-f7bee8d26d4395332b6fdbf3722ae55c31e0238f.zip
no_comment
Diffstat (limited to 'perl-install/install_steps_interactive.pm')
-rw-r--r--perl-install/install_steps_interactive.pm69
1 files changed, 51 insertions, 18 deletions
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index cca487be1..1cedbccf7 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -231,33 +231,66 @@ sub selectPackagesToUpgrade {
}
#------------------------------------------------------------------------------
sub choosePackages {
- my ($o, $packages, $compss, $compssUsers, $compssUsersSorted) = @_;
- my $availableSpace = int(install_any::getAvailableSpace($o) / sqr(1024));
+ my ($o, $packages, $compss, $compssUsers, $compssUsersSorted, $first_time) = @_;
require pkgs;
+ unless ($o->{isUpgrade}) {
+ my $available = pkgs::invCorrectSize(install_any::getAvailableSpace($o) / sqr(1024)) * sqr(1024);
+
+ delete $_->{skip} foreach values %$packages;
+ pkgs::unselect_all($packages);
+ pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $::expert ? 95 : 80, $available, $o->{installClass});
+ my $min_size = pkgs::size_selected($packages);
+
+ do { $o->{compssUsersChoice}{$_} = 1 foreach @$compssUsersSorted, 'Miscellaneous' } if $first_time;
+ $o->chooseGroups($packages, $compssUsers, $compssUsersSorted) unless $::beginner;
+
+ my %save_selected; $save_selected{$_->{name}} = $_->{selected} foreach values %$packages;
+ pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, 1, $available, $o->{installClass});
+ my $max_size = pkgs::size_selected($packages);
+ $_->{selected} = $save_selected{$_->{name}} foreach values %$packages;
+
+ my $size2install = $::beginner ? $available * 0.7 : $o->chooseSizeToInstall($packages, $min_size, $max_size);
+
+ ($o->{packages_}{ind}) =
+ pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, 1, $size2install, $o->{installClass});
+
+# $_->{selected} and log::l("$_->{name}") foreach values %$packages;
+ }
+ $o->choosePackagesTree($packages, $compss) if $::expert;
+}
+
+sub chooseSizeToInstall {
+ my ($o, $packages, $min, $max) = @_;
+ install_any::getAvailableSpace($o) * 0.7;
+}
+sub choosePackagesTree {}
- #- alas, it through away any tree selected packages
- pkgs::unselect_all($o->{packages});
- pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $::expert ? 95 : 80, $availableSpace * 0.7, $o->{installClass}) unless $o->{isUpgrade};
+sub chooseGroups {
+ my ($o, $packages, $compssUsers, $compssUsersSorted) = @_;
$o->ask_many_from_list_ref('',
_("Package Group Selection"),
- [ @$compssUsersSorted ],
- [ map { \$o->{compssUsersChoice}{$_} } @$compssUsersSorted ]
- ) or goto &choosePackages;
- while (my ($k, $v) = each %{$o->{compssUsersChoice}}) {
- $v or next;
- pkgs::select($packages, $_) foreach @{$o->{compssUsers}{$k}};
+ [ @$compssUsersSorted, "Miscellaneous" ],
+ [ map { \$o->{compssUsersChoice}{$_} } @$compssUsersSorted, "Miscellaneous" ]
+ ) or goto &chooseGroups;
+
+ unless ($o->{compssUsersChoice}{Miscellaneous}) {
+ my %l;
+ $l{@{$compssUsers->{$_}}} = () foreach @$compssUsersSorted;
+# exists $l{$_} or print ">>$_\n" foreach keys %$packages;
+ exists $l{$_} or $packages->{$_}{skip} = 1 foreach keys %$packages;
}
- my $current = pkgs::correctedSelectedSize($packages);
- if ($availableSpace < $current) {
- $o->ask_warn('', _("Too many packages chosen: %dMB doesn't fit in %dMB", $current, $availableSpace));
- goto &choosePackages;
+ foreach (@$compssUsersSorted) {
+ $o->{compssUsersChoice}{$_} or pkgs::skip_set($packages, @{$compssUsers->{$_}});
+ }
+ foreach (@$compssUsersSorted) {
+ $o->{compssUsersChoice}{$_} or next;
+ delete $_->{skip} foreach @{$compssUsers->{$_}};
}
-
my $f = "$o->{prefix}/etc/sysconfig/desktop";
- output($f, "KDE\n") if !-e $f && $o->{compssUsersChoice}{KDE};
- output($f, "GNOME\n") if !-e $f && $o->{compssUsersChoice}{Gnome};
+ output($f, "KDE\n") if $o->{compssUsersChoice}{KDE};
+ output($f, "GNOME\n") if $o->{compssUsersChoice}{Gnome};
}
#------------------------------------------------------------------------------