summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/install_steps.pm')
-rw-r--r--perl-install/install_steps.pm36
1 files changed, 32 insertions, 4 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index f3d5787e7..c1e1784e9 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -189,9 +189,39 @@ sub beforeInstallPackages {
pkgs::init_db($o->{prefix}, $o->{isUpgrade});
}
+sub beforeRemoveOtherPackages($) {
+ my ($prefix) = @_;
+
+ #- hack to save some files that may be removed during installation of other packages.
+ do {
+ unlink "$prefix/$_.mdkgisave"; rename "$prefix/$_", "$prefix/$_.mdkgisave";
+ } foreach qw(/etc/passwd);
+}
+
+sub afterRemoveOtherPackages($) {
+ my ($prefix) = @_;
+
+ #- hack to restore what have been saved before removing other packages.
+ do {
+ unlink "$prefix/$_"; rename "$prefix/$_.mdkgisave", "$prefix/$_";
+ } foreach qw(/etc/passwd);
+}
+
sub installPackages($$) {
my ($o, $packages) = @_;
+ if (@{$o->{toRemove} || []}) {
+ my @mdkgisave = qw( /etc/passwd );
+
+ #- hack to ensure proper upgrade of packages from other distribution,
+ #- as release number are not mandrake based. this causes save of very
+ #- important files (not all) and restore them after.
+ #- it is not enough to dop only that.
+ do { unlink "$o->{prefix}/$_.mdkgisave"; rename "$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave"; } foreach @mdkgisave;
+ pkgs::remove($o->{prefix}, $o->{toRemove});
+ do { unlink "$o->{prefix}/$_"; rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_"; } foreach @mdkgisave;
+ }
+
#- hack to ensure proper ordering for installation of packages.
my @firstToInstall = qw(setup basesystem sed);
my %firstInstalled;
@@ -204,7 +234,7 @@ sub installPackages($$) {
}
push @toInstall, grep { $_->{base} && $_->{selected} && !$_->{installed} && !$firstInstalled{$_->{name}} } values %$packages;
push @toInstall, grep { !$_->{base} && $_->{selected} && !$_->{installed} && !$firstInstalled{$_->{name}} } values %$packages;
- pkgs::install($o->{prefix}, \@toInstall);
+ pkgs::install($o->{prefix}, $o->{isUpgrade}, \@toInstall);
}
sub afterInstallPackages($) {
@@ -330,9 +360,7 @@ sub installCrypto {
}
}
}
- foreach (values %$packages) {
- }
- pkgs::install($o->{prefix}, [ values %$packages ]);
+ pkgs::install($o->{prefix}, $o->{isUpgrade}, [ values %$packages ]);
}
#------------------------------------------------------------------------------