summaryrefslogtreecommitdiff
path: root/solenv/bin/lo_find_src_root
diff options
context:
space:
mode:
Diffstat (limited to 'solenv/bin/lo_find_src_root')
-rwxr-xr-xsolenv/bin/lo_find_src_root23
1 files changed, 23 insertions, 0 deletions
diff --git a/solenv/bin/lo_find_src_root b/solenv/bin/lo_find_src_root
new file mode 100755
index 000000000000..a91c84759822
--- /dev/null
+++ b/solenv/bin/lo_find_src_root
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# (c) 2011 Norbert Thiebaud. License : GPLv3
+#
+# try to locate the SRC_ROOT based on the working directory
+# we search for first Repository.mk
+# in the current directoyr or its parent, all teh way to /
+# Ths is a heuristic. it works 'most of the times
+# but it could give false positive if you try hard enough
+#
+
+current=$(pwd)
+
+while [ "${current}" != "/" ] ; do
+ if [ -f ${current}/.src_root ] ; then
+ echo "${current}"
+ exit 0;
+ fi
+ current=$(dirname "${current}")
+done
+
+echo "Error cannot determine SRC_ROOT" 1>&2
+exit 1;