diff options
author | Tim Retout <tim@retout.co.uk> | 2012-09-26 18:21:27 +0100 |
---|---|---|
committer | Tim Retout <tim@retout.co.uk> | 2012-09-26 21:42:06 +0100 |
commit | bc9ad85ca4a70e5b14abe79ea59e848ee3b21e23 (patch) | |
tree | 650732558e3ba6735a80a99d7ec7285b57809568 /solenv/bin/modules/installer.pm | |
parent | 106a1b4eba1303e1d989eb67eff63ed864500578 (diff) |
installer: Move exiter.pm error handling into installer.pm
Change-Id: I50e3ee8ff88f313b82ea617e354334d85fb453e0
Diffstat (limited to 'solenv/bin/modules/installer.pm')
-rw-r--r-- | solenv/bin/modules/installer.pm | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm index 025d47189305..49e2e3c6b2ab 100644 --- a/solenv/bin/modules/installer.pm +++ b/solenv/bin/modules/installer.pm @@ -95,8 +95,12 @@ sub main { run(); }; if ($@) { - warn "$@\n"; + my $message = "ERROR: $@"; + + warn "$message\n"; $exit_code = -1; + + cleanup_on_error($message); } installer::logger::stoptime(); @@ -1820,4 +1824,35 @@ sub run { } # end of iteration for one language group } +sub cleanup_on_error { + my $message = shift; + + # If an installation set is currently created, the directory name + # is saved in $installer::globals::saveinstalldir. If this + # directory name contains "_inprogress", it has to be renamed to + # "_witherror". + if ( $installer::globals::saveinstalldir =~ /_inprogress/ ) { + installer::systemactions::rename_string_in_directory($installer::globals::saveinstalldir, "_inprogress", "_witherror"); + } + + # Removing directories created in the output tree. + installer::worker::clean_output_tree(); + + $installer::globals::logfilename = $installer::globals::exitlog . $installer::globals::logfilename; + + my @log = (@installer::globals::logfileinfo, @installer::globals::globallogfileinfo); + + push(@log, "\n" . '*' x 65 . "\n"); + push(@log, $message); + push(@log, '*' x 65 . "\n"); + + installer::files::save_file($installer::globals::logfilename, \@log); + + print("ERROR, saved logfile $installer::globals::logfilename is:\n"); + open(my $log, "<", $installer::globals::logfilename); + print ": $_" while (<$log>); + print "\n"; + close($log); +} + 1; |