summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-08-25 08:37:18 -0300
committerRenato Botelho <renato@netgate.com>2015-08-25 14:49:54 -0300
commit4a6ea7b2745f25d92024b32571b783b13198818d (patch)
treeacbfcfcc9c5e9d2523bc264ee59b9770497d8f4a
parent782f0bb215d726fe78af0508255e0660ecc82468 (diff)
downloadpfsense-4a6ea7b2745f25d92024b32571b783b13198818d.zip
pfsense-4a6ea7b2745f25d92024b32571b783b13198818d.tar.gz
Change the way to detect BUILDER_SCRIPTS and BUILDER_TOOLS and make build.conf optional
-rw-r--r--tools/builder_defaults.sh20
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/builder_defaults.sh b/tools/builder_defaults.sh
index ffd139f..0b094c5 100644
--- a/tools/builder_defaults.sh
+++ b/tools/builder_defaults.sh
@@ -57,16 +57,22 @@
# beginning of this file #
###########################################
-BUILD_CONF="$(realpath $(dirname ${0}))/build.conf"
+# Detect if this file is being sourced by a script from root or from tools
+local _curdir=$(basename $(dirname ${0}))
+
+if [ "${_curdir}" = "tools" ]; then
+ export BUILDER_SCRIPTS=$(realpath ${_curdir})
+ export BUILDER_TOOLS=$(realpath "${_curdir}/..")
+else
+ export BUILDER_SCRIPTS=$(realpath "${_curdir}/tools")
+ export BUILDER_TOOLS=$(realpath "${_curdir}")
+fi
+
+BUILD_CONF="${BUILDER_TOOLS}/build.conf"
# Ensure file exists
if [ -f ${BUILD_CONF} ]; then
. ${BUILD_CONF}
-else
- echo
- echo "You must first run ./set_version.sh !"
- echo
- exit 2
fi
# Make sure pkg will not be interactive
@@ -108,8 +114,6 @@ export SCRATCHDIR=${SCRATCHDIR:-/tmp}
# Area that the final image will appear in
export MAKEOBJDIRPREFIXFINAL=${MAKEOBJDIRPREFIXFINAL:-${SCRATCHDIR}/${PRODUCT_NAME}/}
-export BUILDER_SCRIPTS=${BUILDER_SCRIPTS:-$(realpath $(dirname ${0}))}
-export BUILDER_TOOLS=${BUILDER_TOOLS:-$(realpath ${BUILDER_SCRIPTS}/..)}
export TOOLS_DIR=${TOOLS_DIR:-$(basename ${BUILDER_TOOLS})}
export BASE_DIR=${BASE_DIR:-$(realpath ${BUILDER_TOOLS}/..)}
OpenPOWER on IntegriCloud