Commit 61a0a68f authored by Leigh Stoller's avatar Leigh Stoller

Add a PhaseStop() function, which gracefully stops the update process,

so that we can tell the user to do something. For example, after
installing xerces, we need the user to reconfig/rebuild the object
tree and restart the installation.
parent d8109b8b
......@@ -13,12 +13,14 @@ use Exporter;
use vars qw(@EXPORT $TOP_OBJDIR $TOP_SRCDIR
$TBROOT $LOGDIR $MAINSITE $PGENISUPPORT $GMAKE $PKG_INFO
$PORTSDIR $VARRUN $RCDIR $MYSQL $DBNAME
$SQL_UPDATE_MAJOR_REVISION $INSTALL_UPDATE_MAJOR_REVISION);
$SQL_UPDATE_MAJOR_REVISION $INSTALL_UPDATE_MAJOR_REVISION
$HAVE_XERCES);
@EXPORT = qw($TOP_OBJDIR $TOP_SRCDIR
$TBROOT $LOGDIR $MAINSITE $PGENISUPPORT $GMAKE $PKG_INFO
$PORTSDIR $VARRUN $RCDIR $MYSQL $DBNAME
$SQL_UPDATE_MAJOR_REVISION $INSTALL_UPDATE_MAJOR_REVISION);
$SQL_UPDATE_MAJOR_REVISION $INSTALL_UPDATE_MAJOR_REVISION
$HAVE_XERCES);
# Configure variables
......@@ -35,6 +37,7 @@ $RCDIR = "/usr/local/etc/rc.d";
$DBNAME = "@TBDBNAME@";
$MYSQL = "/usr/local/bin/mysql";
$HAVE_XERCES = "@HAVE_XERCES@";
# Change these if the major numbers in sql/updates or install/updates
# are changed.
......@@ -148,6 +151,7 @@ sub Phase($$$) {
#
my $message = "";
my $die = 0;
my $stop = 0;
if ($hasSubPhase) {
print "| " x ($depth -1) . "+-" . "--" x (24 - $depth) . "> ";
}
......@@ -180,6 +184,28 @@ sub Phase($$$) {
last SWITCH;
};
(/^stop$/) && do {
print "[ Stopped ]\n";
print $logfp "[ Stopped ($libinstall::reason) ]\n"
if ($impotent && defined($logfp));
$$parentNonSkipped++;
$message = "$libinstall::reason";
if ($impotent) {
$libinstall::phaseResults{$name} = "succeed";
}
else {
$libinstall::phaseResults{$name} = $_;
$stop = 1;
if ($isSubPhase) {
#
# Propagate failure up the tree
#
PhaseStop($libinstall::reason);
}
}
last SWITCH;
};
(undef || /^$/ || /^succeed$/) && do {
#
# If we're a parent, and all sub-phases got skipped, we did too
......@@ -229,6 +255,18 @@ sub Phase($$$) {
}
}
#
# If we decided that we need to stop, do that now
#
if ($stop) {
print "\n";
print "############################################################\n";
print "Installation stopped in phase $name. The reason is:\n";
print "$message\n";
print "############################################################\n";
exit -1;
}
#
# If we decided that we need to die, do that now
#
......@@ -268,6 +306,14 @@ sub PhaseFail($) {
throw "fail";
}
#
# Signal that the current phase needs to stop so the user can do something.
#
sub PhaseStop($) {
($libinstall::reason) = (@_);
throw "stop";
}
#
# Signal that the current phase is being skipped
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment