summaryrefslogtreecommitdiffstats
path: root/tools
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
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')
-rwxr-xr-xtools/build_snapshots.sh8
-rw-r--r--tools/builder_defaults.sh22
2 files changed, 17 insertions, 13 deletions
diff --git a/tools/build_snapshots.sh b/tools/build_snapshots.sh
index efecfae..77ff0f6 100755
--- a/tools/build_snapshots.sh
+++ b/tools/build_snapshots.sh
@@ -30,10 +30,8 @@
# OF THE POSSIBILITY OF SUCH DAMAGE.
#
-if [ ! -f ./build.conf ]; then
- echo "You must first run ./set_version.sh !"
- exit 1
-fi
+export BUILDER_TOOLS=$(realpath $(dirname ${0}))
+export BUILDER_ROOT=$(realpath "${BUILDER_TOOLS}/..")
NO_UPLOAD=""
LOOPED_SNAPSHOTS=""
@@ -56,7 +54,7 @@ done
# *** SOME UNKNOWN LAYERING REASON.
# *** 04/07/2008, 11/04/2009
echo ">>> Execing build.conf"
-. ./builder_defaults.sh
+. ${BUILDER_TOOLS}/builder_defaults.sh
# Keeps track of how many time builder has looped
BUILDCOUNTER=0
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