From 63472d7ca9a410a8e4068dfac06a6d95a529e349 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 19 Nov 2018 12:39:07 -0200 Subject: [PATCH] IDEMPIERE-3655 Improve installer to include migration scripts and syncApplied / safe error message when folder does not exist --- .../utils.unix/oracle/SyncDB.sh | 7 +++++++ .../utils.unix/postgresql/SyncDB.sh | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh b/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh index 66f9d8ca5f..fb132d2791 100644 --- a/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh +++ b/org.adempiere.server-feature/utils.unix/oracle/SyncDB.sh @@ -44,6 +44,11 @@ else fi cd "$DIR_SCRIPTS" +if [ $? -ne 0 ] +then + echo "ERROR: Cannot change to folder $DIR_SCRIPTS" + exit 1 +fi # Create list of files already applied - registered in AD_MigrationScript table echo "set heading off @@ -109,4 +114,6 @@ if [ -n "$MSGERROR" ] then echo "$MSGERROR" echo "\n Errors were found during the process (see message above) - please review and fix the error running manually the script - and then restart this process again" + exit 1 fi +exit 0 diff --git a/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh b/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh index a3f4767f6e..dd81b3214d 100644 --- a/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh +++ b/org.adempiere.server-feature/utils.unix/postgresql/SyncDB.sh @@ -46,6 +46,11 @@ else fi cd "$DIR_SCRIPTS" +if [ $? -ne 0 ] +then + echo "ERROR: Cannot change to folder $DIR_SCRIPTS" + exit 1 +fi # Create list of files already applied - registered in AD_MigrationScript table echo "select name from ad_migrationscript" | $SILENTCMD | sed -e 's:^ ::' | grep -v '^$' | sort > $TMPFOLDER/lisDB_$$.txt @@ -102,11 +107,12 @@ then fi done fi +PGPASSWORD= +export PGPASSWORD if [ -n "$MSGERROR" ] then echo "$MSGERROR" echo "\n Errors were found during the process (see message above) - please review and fix the error running manually the script - and then restart this process again" + exit 1 fi - -PGPASSWORD= -export PGPASSWORD +exit 0