summaryrefslogtreecommitdiffstats
path: root/tools/builder_defaults.sh
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-08-25 10:45:16 -0300
committerRenato Botelho <renato@netgate.com>2015-08-25 14:49:57 -0300
commitf36b26f8bc25ac9832d1ceeea207f46657482893 (patch)
tree363eedaeb6dd086581d3008fb632e5f17fcae956 /tools/builder_defaults.sh
parent7e6ab3edfdad4581d5cc54516f5690b0220480b6 (diff)
downloadpfsense-f36b26f8bc25ac9832d1ceeea207f46657482893.zip
pfsense-f36b26f8bc25ac9832d1ceeea207f46657482893.tar.gz
Define BUILDER_TOOLS and BUILDER_ROOT on caller scripts and add extra checks
Diffstat (limited to 'tools/builder_defaults.sh')
-rw-r--r--tools/builder_defaults.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/tools/builder_defaults.sh b/tools/builder_defaults.sh
index 9602fcb..6eebb5c 100644
--- a/tools/builder_defaults.sh
+++ b/tools/builder_defaults.sh
@@ -57,15 +57,21 @@
# beginning of this file #
###########################################
-# Detect if this file is being sourced by a script from root or from tools
-local _curdir=$(basename $(dirname ${0}))
+if [ -z "${BUILDER_ROOT}" ]; then
+ echo ">>> ERROR: BUILDER_ROOT must be defined by script that includes builder_defaults.sh"
+ exit 1
+fi
-if [ "${_curdir}" = "tools" ]; then
- export BUILDER_TOOLS=$(realpath ${_curdir})
- export BUILDER_ROOT=$(realpath "${_curdir}/..")
-else
- export BUILDER_TOOLS=$(realpath "${_curdir}/tools")
- export BUILDER_ROOT=$(realpath "${_curdir}")
+if [ -d "${BUILDER_ROOT}" ]; then
+ echo ">>> ERROR: BUILDER_ROOT is invalid"
+ exit 1
+fi
+
+export BUILDER_TOOLS=${BUILDER_TOOLS:-"${BUILDER_ROOT}/tools"}
+
+if [ -d "${BUILDER_TOOLS}" ]; then
+ echo ">>> ERROR: BUILDER_TOOLS is invalid"
+ exit 1
fi
BUILD_CONF="${BUILDER_ROOT}/build.conf"
OpenPOWER on IntegriCloud