summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/ChangeLog7
-rw-r--r--perl-install/install2.pm32
-rw-r--r--perl-install/install_any.pm3
-rw-r--r--perl-install/install_steps.pm21
-rw-r--r--perl-install/install_steps_gtk.pm8
-rw-r--r--perl-install/install_steps_interactive.pm30
-rw-r--r--perl-install/pkgs.pm30
7 files changed, 92 insertions, 39 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog
index 93ded5e20..9b5d770b3 100644
--- a/perl-install/ChangeLog
+++ b/perl-install/ChangeLog
@@ -1,3 +1,10 @@
+2000-04-28 François Pons <fpons@mandrakesoft.com>
+
+ * install_steps*.pm: added support for selection of package during
+ upgrade the same way it is done for installation. added check of
+ minimal size, abort else (at least let the user know about :-)
+ fixed crypto if no network interface available.
+
2000-04-28 Pixel <pixel@mandrakesoft.com>
* install_any.pm (getHds): changed the mount point setting for
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 940675c23..fd9cfc9dc 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -345,24 +345,24 @@ sub formatPartitions {
#------------------------------------------------------------------------------
sub choosePackages {
require pkgs;
- $o->setPackages if $_[1] == 1;
- $o->selectPackagesToUpgrade($o) if $o->{isUpgrade} && $_[1] == 1;
- if ($_[1] > 1 || !$o->{isUpgrade} || $::expert) {
- if ($_[1] == 1) {
- $o->{compssUsersChoice}{$_} = 1 foreach @{$o->{compssUsersSorted}}, 'Miscellaneous';
-# $o->{compssUsersChoice}{KDE} = 0 if $o->{lang} =~ /ja|el|ko|th|vi|zh/; #- gnome handles much this fonts much better
- }
- $o->choosePackages($o->{packages}, $o->{compss},
- $o->{compssUsers}, $o->{compssUsersSorted}, $_[1] == 1);
- my $pkg = pkgs::packageByName($o->{packages}, 'kdesu');
- pkgs::unselectPackage($o->{packages}, $pkg) if $pkg && $o->{security} > 3;
-
- #- check pre-condition where base backage has to be selected.
- pkgs::packageFlagSelected(pkgs::packageByName($o->{packages}, 'basesystem')) or die "basesystem package not selected";
+ if ($_[1] == 1) {
+ $o->setPackages;
+ $o->selectPackagesToUpgrade($o) if $o->{isUpgrade};
- #- check if there are package that need installation.
- $o->{steps}{doInstallStep}{done} = 0 if $o->{steps}{doInstallStep}{done} && pkgs::packagesToInstall($o->{packages}) > 0;
+ $o->{compssUsersChoice}{$_} = 1 foreach @{$o->{compssUsersSorted}}, 'Miscellaneous';
+ # $o->{compssUsersChoice}{KDE} = 0 if $o->{lang} =~ /ja|el|ko|th|vi|zh/; #- gnome handles much this fonts much better
}
+
+ $o->choosePackages($o->{packages}, $o->{compss},
+ $o->{compssUsers}, $o->{compssUsersSorted}, $_[1] == 1);
+ my $pkg = pkgs::packageByName($o->{packages}, 'kdesu');
+ pkgs::unselectPackage($o->{packages}, $pkg) if $pkg && $o->{security} > 3;
+
+ #- check pre-condition where base backage has to be selected.
+ pkgs::packageFlagSelected(pkgs::packageByName($o->{packages}, 'basesystem')) or die "basesystem package not selected";
+
+ #- check if there are package that need installation.
+ $o->{steps}{doInstallStep}{done} = 0 if $o->{steps}{doInstallStep}{done} && pkgs::packagesToInstall($o->{packages}) > 0;
}
#------------------------------------------------------------------------------
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 4d9a1e3ce..9bb37a714 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -277,7 +277,8 @@ sub setPackages($) {
$_->{values} = [ map { $_ + 50 } @{$_->{values}} ] foreach grep {$_} map { pkgs::packageByName($o->{packages}, $_) } @l;
} else {
- pkgs::unselectAllPackages($o->{packages});
+ #- remove upgrade flag with selection one.
+ pkgs::unselectAllPackagesIncludingUpgradable($o->{packages});
}
}
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 10d114b8a..0d425d209 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -2,7 +2,7 @@ package install_steps;
use diagnostics;
use strict;
-use vars qw(@filesToSaveForUpgrade);
+use vars qw($minAvailableSize @filesToSaveForUpgrade);
#-######################################################################################
#- misc imports
@@ -24,6 +24,7 @@ use network;
use any;
use fs;
+$minAvailableSize = 5 * sqr(1024);
@filesToSaveForUpgrade = qw(
/etc/ld.so.conf /etc/fstab /etc/hosts /etc/conf.modules
);
@@ -221,10 +222,15 @@ sub selectPackagesToUpgrade {
sub choosePackages {
my ($o, $packages, $compss, $compssUsers, $compssUsersSorted, $first_time) = @_;
- return if $o->{isUpgrade};
+ #- now for upgrade, package that must be upgraded are
+ #- selected first, after is used the same scheme as install.
+
+ #- make sure we kept some space left for available else the system may
+ #- not be able to start (xfs at least).
+ my $available = install_any::getAvailableSpace($o) - $minAvailableSize;
+ my $availableCorrected = pkgs::invCorrectSize($available / sqr(1024)) * sqr(1024);
+ $available < $availableCorrected or $available = $availableCorrected;
- my $available = pkgs::invCorrectSize(install_any::getAvailableSpace($o) / sqr(1024)) * sqr(1024);
-
foreach (values %{$packages->[0]}) {
pkgs::packageSetFlagSkip($_, 0);
pkgs::packageSetFlagUnskip($_, 0);
@@ -908,6 +914,13 @@ sub generateAutoInstFloppy($) {
}
#------------------------------------------------------------------------------
+sub hasNetwork {
+ my ($o) = @_;
+
+ $o->{intf} && $o->{netc}{NETWORKING} ne 'false' || $o->{modem};
+}
+
+#------------------------------------------------------------------------------
sub upNetwork {
my ($o, $pppAvoided) = @_;
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index 8df4840fb..b5ab22045 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -471,6 +471,14 @@ sub choosePackagesTree {
return $o->ask_warn('', _("This is a mandatory package, it can't be unselected"));
} elsif (pkgs::packageFlagInstalled($p)) {
return $o->ask_warn('', _("You can't unselect this package. It is already installed"));
+ } elsif (pkgs::packageFlagUpgrade($p)) {
+ if ($::expert) {
+ if (pkgs::packageFlagSelected($p)) {
+ $o->ask_yesorno('', _("This package must be upgraded\nAre you sure you want to deselect it?")) or return;
+ }
+ } else {
+ return $o->ask_warn('', _("You can't unselect this package. It must be upgraded"));
+ }
}
pkgs::togglePackageSelection($packages, $p, my $l = {});
if (my @l = grep { $l->{$_} } keys %$l) {
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 23fcd6e89..8092c43c0 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -123,7 +123,7 @@ You will be allowed to make powerfull but dangerous things here."),
first(list2kv(@c)), ${{reverse %c}}{$::beginner ? "beginner" : $::expert ? "expert" : "specific"},
[ __("Install"), __("Upgrade") ], $o->{isUpgrade} ? "Upgrade" : "Install") eq "Upgrade";
- if ($::corporate || $::beginner || $o->{isUpgrade}) {
+ if ($::corporate || $::beginner) {
delete $o->{installClass};
} else {
my %c = (
@@ -274,28 +274,28 @@ sub choosePackages {
my $individual = $::expert;
require pkgs;
- unless ($o->{isUpgrade}) {
- my $min_size = pkgs::selectedSize($packages);
- $o->chooseGroups($packages, $compssUsers, $compssUsersSorted, \$individual) unless $::beginner || $::corporate;
+ my $min_size = pkgs::selectedSize($packages);
+ $min_size < $available or die _("Your system has not enough space left for installation or upgrade");
- my $min_mark = $::beginner ? 25 : 1;
- my @l = values %{$packages->[0]};
- my @flags = map { pkgs::packageFlagSelected($_) } @l;
- pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, 0, $o->{installClass});
- my $max_size = pkgs::selectedSize($packages);
- mapn { pkgs::packageSetFlagSelected(@_) } \@l, \@flags;
+ $o->chooseGroups($packages, $compssUsers, $compssUsersSorted, \$individual) unless $::beginner || $::corporate;
+
+ my $min_mark = $::beginner ? 25 : 1;
+ my @l = values %{$packages->[0]};
+ my @flags = map { pkgs::packageFlagSelected($_) } @l;
+ 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, $max_size, $available, $individual) 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});
- }
+ ($o->{packages_}{ind}) =
+ pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, $min_mark, $size2install, $o->{installClass});
$o->choosePackagesTree($packages, $compss) if $individual;
}
@@ -522,7 +522,7 @@ sub installCrypto {
my ($o) = @_;
my $u = $o->{crypto} ||= {};
- $::expert or return;
+ $::expert and $o->hasNetwork or return;
is_empty_hash_ref($u) and $o->ask_yesorno('',
_("You have now the possibility to download software aimed for encryption.
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index eb6b88050..6a36eb9aa 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -2,7 +2,7 @@ package pkgs;
use diagnostics;
use strict;
-use vars qw(*LOG %compssListDesc @skip_list %by_lang @preferred $limitMinTrans $PKGS_SELECTED $PKGS_FORCE $PKGS_INSTALLED $PKGS_BASE $PKGS_SKIP $PKGS_UNSKIP);
+use vars qw(*LOG %compssListDesc @skip_list %by_lang @preferred $limitMinTrans $PKGS_SELECTED $PKGS_FORCE $PKGS_INSTALLED $PKGS_BASE $PKGS_SKIP $PKGS_UNSKIP $PKGS_UPGRADE);
use common qw(:common :file :functional);
use install_any;
@@ -94,6 +94,7 @@ $PKGS_INSTALLED = 0x02000000;
$PKGS_BASE = 0x04000000;
$PKGS_SKIP = 0x08000000;
$PKGS_UNSKIP = 0x10000000;
+$PKGS_UPGRADE = 0x20000000;
#- basic methods for extracting informations about packages.
#- to save memory, (name, version, release) are no more stored, they
@@ -116,6 +117,7 @@ sub packageFlagInstalled { my ($pkg) = @_; $pkg->{flags} & $PKGS_INSTALLED }
sub packageFlagBase { my ($pkg) = @_; $pkg->{flags} & $PKGS_BASE }
sub packageFlagSkip { my ($pkg) = @_; $pkg->{flags} & $PKGS_SKIP }
sub packageFlagUnskip { my ($pkg) = @_; $pkg->{flags} & $PKGS_UNSKIP }
+sub packageFlagUpgrade { my ($pkg) = @_; $pkg->{flags} & $PKGS_UPGRADE }
sub packageSetFlagSelected { my ($pkg, $v) = @_; $pkg->{flags} &= ~$PKGS_SELECTED; $pkg->{flags} |= $v & $PKGS_SELECTED; }
@@ -124,6 +126,7 @@ sub packageSetFlagInstalled { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_I
sub packageSetFlagBase { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_BASE) : ($pkg->{flags} &= ~$PKGS_BASE); }
sub packageSetFlagSkip { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_SKIP) : ($pkg->{flags} &= ~$PKGS_SKIP); }
sub packageSetFlagUnskip { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_UNSKIP) : ($pkg->{flags} &= ~$PKGS_UNSKIP); }
+sub packageSetFlagUpgrade { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_UPGRADE) : ($pkg->{flags} &= ~$PKGS_UPGRADE); }
sub packageProvides { my ($pkg) = @_; @{$pkg->{provides} || []} }
@@ -309,7 +312,20 @@ sub setPackageSelection($$$) {
sub unselectAllPackages($) {
my ($packages) = @_;
- packageFlagBase($_) or packageSetFlagSelected($_, 0) foreach values %{$packages->[0]};
+ foreach (values %{$packages->[0]}) {
+ unless (packageFlagBase($_) || packageFlagUpgrade($_)) {
+ packageSetFlagSelected($_, 0);
+ }
+ }
+}
+sub unselectAllPackagesIncludingUpgradable($) {
+ my ($packages, $removeUpgradeFlag) = @_;
+ foreach (values %{$packages->[0]}) {
+ unless (packageFlagBase($_)) {
+ packageSetFlagSelected($_, 0);
+ packageSetFlagUpgrade($_, 0);
+ }
+ }
}
sub skipSetWithProvides {
@@ -650,7 +666,7 @@ sub versionCompare($$) {
}
}
-sub selectPackagesToUpgrade($$$;$$) { #- TODO
+sub selectPackagesToUpgrade($$$;$$) {
my ($packages, $prefix, $base, $toRemove, $toSave) = @_;
log::l("reading /usr/lib/rpm/rpmrc");
@@ -801,6 +817,14 @@ sub selectPackagesToUpgrade($$$;$$) { #- TODO
}
}
+ #- keep a track of packages that are been selected for being upgraded,
+ #- these packages should not be unselected.
+ foreach (values %{$packages->[0]}) {
+ my $p = $_;
+
+ packageSetFlagUpgrade($p, 1) if packageFlagSelected($p);
+ }
+
#- clean false value on toRemove.
delete $toRemove{''};