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.pm45
1 files changed, 44 insertions, 1 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 5f2c4bddd..cbb3ce38e 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -21,6 +21,10 @@ use commands;
use network;
use fs;
+my @filesToSaveForUpgrade = qw(
+/etc/ld.so.conf /etc/fstab /etc/hosts /etc/conf.modules
+);
+
#-######################################################################################
#- OO Stuff
@@ -183,6 +187,21 @@ sub choosePackages($$$$) {
sub beforeInstallPackages {
my ($o) = @_;
+
+ #- save these files in case of upgrade failure.
+ if ($o->{isUpgrade}) {
+ foreach (@filesToSaveForUpgrade) {
+ unlink "$o->{prefix}/$_.mdkgisave";
+ if (-e "$o->{prefix}/$_") {
+ eval { commands::cp("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
+ }
+ }
+ }
+
+ #- some packages need such files for proper installation.
+ install_any::write_ldsoconf($o->{prefix});
+ fs::write($o->{prefix}, $o->{fstab}, $o->{manualFstab}, $o->{useSupermount});
+
network::add2hosts("$o->{prefix}/etc/hosts", "localhost.localdomain", "127.0.0.1");
require pkgs;
pkgs::init_db($o->{prefix}, $o->{isUpgrade});
@@ -303,6 +322,15 @@ GridHeight=70
log::l("moving previous desktop files that have been updated to Trash of each user");
install_any::move_desktop_file($o->{prefix});
}
+
+ #- rename saved files to .mdkgiorig.
+ if ($o->{isUpgrade}) {
+ foreach (@filesToSaveForUpgrade) {
+ if (-e "$o->{prefix}$_.mdkgisave") {
+ unlink "$o->{prefix}$_.mdkgiorig"; rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_.mdkgiorig";
+ }
+ }
+ }
}
#------------------------------------------------------------------------------
@@ -667,7 +695,22 @@ sub miscellaneous {
}
#------------------------------------------------------------------------------
-sub exitInstall { install_any::ejectCdrom }
+sub cleanIfFailedUpgrade($) {
+ my ($o) = @_;
+
+ #- if an upgrade has failed, there should be .mdkgisave files around.
+ if ($o->{isUpgrade}) {
+ foreach (@filesToSaveForUpgrade) {
+ if (-e "$o->{prefix}/$_" && -e "$o->{prefix}/$_.mdkgisave") {
+ rename "$o->{prefix}/$_", "$o->{prefix}/$_.mdkginew"; #- keep new files around in case !
+ rename "$o->{prefix}/$_.mdkgisave", "$o->{prefix}/$_";
+ }
+ }
+ }
+}
+
+#------------------------------------------------------------------------------
+sub exitInstall { install_any::ejectCdrom; }
#-######################################################################################
#- Wonderful perl :(