summaryrefslogtreecommitdiffstats
path: root/perl-install/install_steps.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-01-07 09:41:23 +0000
committerFrancois Pons <fpons@mandriva.com>2000-01-07 09:41:23 +0000
commite28cc9776192f3d4bbc86bd2781106faf6d0b656 (patch)
tree0f943fad5881626372947dac6f41c8f41a5a4724 /perl-install/install_steps.pm
parent4a92ef9d28a3b4241186678c3fa3b4ebd365809d (diff)
downloaddrakx-backup-do-not-use-e28cc9776192f3d4bbc86bd2781106faf6d0b656.tar
drakx-backup-do-not-use-e28cc9776192f3d4bbc86bd2781106faf6d0b656.tar.gz
drakx-backup-do-not-use-e28cc9776192f3d4bbc86bd2781106faf6d0b656.tar.bz2
drakx-backup-do-not-use-e28cc9776192f3d4bbc86bd2781106faf6d0b656.tar.xz
drakx-backup-do-not-use-e28cc9776192f3d4bbc86bd2781106faf6d0b656.zip
*** empty log message ***
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 :(