summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts/local/scripts/_build_common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'debian/_buildscripts/local/scripts/_build_common.sh')
-rwxr-xr-xdebian/_buildscripts/local/scripts/_build_common.sh53
1 files changed, 32 insertions, 21 deletions
diff --git a/debian/_buildscripts/local/scripts/_build_common.sh b/debian/_buildscripts/local/scripts/_build_common.sh
index 41ca19cf9..72649dc89 100755
--- a/debian/_buildscripts/local/scripts/_build_common.sh
+++ b/debian/_buildscripts/local/scripts/_build_common.sh
@@ -37,28 +37,9 @@ function init_common()
{
# Check script folder
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
- cd $SCRIPT_DIR
- BASE_DIR=${PWD##*/}
- if [ "$BASE_DIR" != "scripts" ]; then
- echo "This script can only be run from the script directory."
- exit 1
- fi
-
- #----------------------------
- # TDE source folder
- cd `git rev-parse --show-toplevel`
- CURR_DIR=${PWD##*/}
- if [ "$CURR_DIR" != "tde-packaging" ]; then
- echo "Something wrong with folder structure.\nThis script should be located in the tde-packaging directory."
- exit 1
- fi
- cd ../..
- TDE_DIR=$PWD
- cd $SCRIPT_DIR
- #----------------------------
# Read config settings
- CFG_FILE=$TDE_DIR/build_config.sh
+ CFG_FILE=$SCRIPT_DIR/build_config.sh
if [ -f "$CFG_FILE" ]; then
. "$CFG_FILE"
else
@@ -66,8 +47,38 @@ function init_common()
echo "Creating TDE build configuration file from template as $CFG_FILE."
echo "Please check and modify as required, then rerun this script."
cp "$SCRIPT_DIR/_build_config_template.sh" "$CFG_FILE"
- exit 0
+ exit 1
+ fi
+
+ # TDE root folder must exist
+ if [ ! -d "$TDE_DIR" ]; then
+ echo -e "${CYellow} --- ERROR ---${CNone}"
+ echo "A valid TDE root folder could not be located. Something is wrong with your configuration"
+ echo "in the config file $CFG_FILE"
+ echo "Please check and modify the TDE_DIR variable as required, then rerun this script."
+ exit 2
+ fi
+ # Search for main TDE repo
+ cd "$TDE_DIR/$CFG_GIT_TDE_MAIN" &>/dev/null
+ CURR_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
+ if [ -z "$CURR_DIR" ]; then
+ echo -e "${CYellow} --- ERROR ---${CNone}"
+ echo "Main TDE repo could not be located. Something is wrong with your configuration"
+ echo "in the config file $CFG_FILE"
+ echo "Please check and modify the TDE_DIR variable as required, then rerun this script."
+ exit 3
+ fi
+ # Search for TDE packaging repo
+ cd "$TDE_DIR/$CFG_GIT_TDE_PACKAGING" &>/dev/null
+ CURR_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
+ if [ -z "$CURR_DIR" ]; then
+ echo -e "${CYellow} --- ERROR ---${CNone}"
+ echo "TDE packaging repo could not be located. Something is wrong with your configuration"
+ echo "in the config file $CFG_FILE"
+ echo "Please check and modify the TDE_DIR variable as required, then rerun this script."
+ exit 4
fi
+
SCRIPT_LOG_DIR=$TDE_DIR/$CFG_SCRIPT_LOG_DIR
LOG_RESULT_FILENAME="$SCRIPT_LOG_DIR/build_result.log" # Log result into the common build logfile