summaryrefslogtreecommitdiff
path: root/scripts/deptest.sh
diff options
context:
space:
mode:
authorMichael Büsch <mb@bu3sch.de>2010-11-02 23:22:34 +0000
committerMichael Büsch <mb@bu3sch.de>2010-11-02 23:22:34 +0000
commite37d386dfcf1fdd40652848204657d6ebfb11560 (patch)
tree385c3070a1f8180afbaba0206f0a7afeec058525 /scripts/deptest.sh
parent0cacb5855d376f5f10cf2bc2951d240485025e82 (diff)
downloadmtk-20170518-e37d386dfcf1fdd40652848204657d6ebfb11560.zip
mtk-20170518-e37d386dfcf1fdd40652848204657d6ebfb11560.tar.gz
mtk-20170518-e37d386dfcf1fdd40652848204657d6ebfb11560.tar.bz2
deptest: Better detection of base directory
SVN-Revision: 23807
Diffstat (limited to 'scripts/deptest.sh')
-rwxr-xr-xscripts/deptest.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/scripts/deptest.sh b/scripts/deptest.sh
index b82ac46..2864cd1 100755
--- a/scripts/deptest.sh
+++ b/scripts/deptest.sh
@@ -1,23 +1,31 @@
#!/bin/bash
-DIR="$PWD/tmp/deptest"
+SCRIPTDIR="$(dirname "$0")"
+[ "${SCRIPTDIR:0:1}" = "/" ] || SCRIPTDIR="$PWD/$SCRIPTDIR"
+BASEDIR="$SCRIPTDIR/.."
+
+DIR="$BASEDIR/tmp/deptest"
STAMP_DIR_SUCCESS="$DIR/stamp-success"
STAMP_DIR_FAILED="$DIR/stamp-failed"
-BUILD_DIR="$DIR/build"
-BUILD_DIR_HOST="$DIR/build_host"
-STAGING_DIR="$DIR/staging"
-STAGING_DIR_HOST="$DIR/staging_host"
-STAGING_DIR_HOST_TMPL="$DIR/staging_host_tmpl"
+BUILD_DIR="$DIR/build_dir/target"
+BUILD_DIR_HOST="$DIR/build_dir/host"
+STAGING_DIR="$DIR/staging_dir"
+STAGING_DIR_HOST="$DIR/staging_dir_host"
+STAGING_DIR_HOST_TMPL="$DIR/staging_dir_host_tmpl"
LOG_DIR="$DIR/logs"
-mkdir -p "$STAMP_DIR_SUCCESS" "$STAMP_DIR_FAILED" "$BUILD_DIR" "$LOG_DIR"
-
die()
{
echo "$@"
exit 1
}
+[ -f "$BASEDIR/include/toplevel.mk" ] || \
+ die "Error: Could not find buildsystem base directory"
+cd "$BASEDIR" || die "Failed to enter base directory"
+
+mkdir -p "$STAMP_DIR_SUCCESS" "$STAMP_DIR_FAILED" "$BUILD_DIR" "$BUILD_DIR_HOST" "$LOG_DIR"
+
[ -d "$STAGING_DIR_HOST_TMPL" ] || {
rm -rf staging_dir/host
make tools/install V=99 || die "make tools/install failed, please check"