office-gobmx/solenv/bin/lo_find_src_root
Norbert Thiebaud cb70868bda add utility script and build_env to avoid sourcing Env.Host.sh
The goal is to able to do partial build without having
to source Env.Host.sh into one's environment

There is 2 way to use this:

1/
copy the scripts lo_find_src_root and lo_proxy_start
somewhere in your PATH, and
then you can add
alias build='lo_proxy_start build'
alias deliver='lo_proxy_start deliver'
in your .bashrc

at that point you can use build and deliver anywhere in the source tree
without the need to source anything.
This allow you to switch from one source tree to another.
the proper SRC_ROOT will be determined automatically based
on the current working directory

2/
source build_env

build_env only source the bare minimum to allow build and make to work
for the associated source tree.
If you want to work in a diffrent tree, you need to resource
2011-11-16 06:18:53 -06:00

23 lines
573 B
Bash
Executable file

#!/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;