Skip to content

Commit

Permalink
fix some problems with bootstrap script
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Jul 12, 2017
1 parent c20f8fb commit b202433
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions bin/desiBootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function usage() {
echo ""
echo "Install desiutil on a bare system."
echo ""
ecoh " -a = Version of DESI+Anaconda software stack."
echo " -a = Version of DESI+Anaconda software stack."
echo " -c = Pass CONFIG to desiInstall."
echo " -h = Print this message and exit."
echo " -m = Look for the Modules install in MODULESHOME."
Expand All @@ -27,7 +27,7 @@ verbose=''
modules=''
py=''
config=''
while getopts c:hm:p:tv argname; do
while getopts a:c:hm:p:tv argname; do
case ${argname} in
a) anaconda=${OPTARG} ;;
c) config="-c ${OPTARG}" ;;
Expand All @@ -41,7 +41,7 @@ while getopts c:hm:p:tv argname; do
done
shift $((OPTIND-1))
#
# Install
# Validate options
#
if [[ -z "${DESI_PRODUCT_ROOT}" && -z "${NERSC_HOST}" ]]; then
echo "You haven't set the DESI_PRODUCT_ROOT environment variable."
Expand All @@ -55,9 +55,37 @@ if [[ -z "${MODULESHOME}" ]]; then
echo "You do not appear to have Modules installed."
exit 1
fi
if [[ -n "${NERSC_HOST}" && -z "${py}" ]]; then
#
# Make certain we are using the Python version associated with the
# specified DESI+Anaconda stack.
#
common_root=/global/common/${NERSC_HOST}/contrib/desi/desiconda/${anaconda}
software_root=/global/project/projectdirs/desi/software/${NERSC_HOST}/desiconda/${anaconda}
for d in ${common_root} ${software_root}; do
if [[ -d ${d} ]]; then
if [[ "${anaconda}" == "current" ]]; then
anaconda=$(readlink ${d})
dd=$(dirname ${d})/${anaconda}
else
dd=${d}
fi
py=${dd}/code/desiconda/${anaconda}_conda/bin/python
if [[ ! -x ${py} ]]; then
echo "Python executable not found!"
exit 1
fi
fi
done
if [[ -z "${py}" ]]; then
echo "Could not find Python executable associated with '${anaconda}' on ${NERSC_HOST}!"
exit 1
fi
fi
#
# Export
#
[[ -n "${verbose}" ]] && echo git clone https://github.com/desihub/desiutil.git desiutil-master
git clone https://github.com/desihub/desiutil.git desiutil-master
export DESIUTIL=$(pwd)/desiutil-master
export PATH=${DESIUTIL}/bin:${PATH}
Expand All @@ -67,8 +95,11 @@ else
export PYTHONPATH=${DESIUTIL}/py:${PYTHONPATH}
fi
if [[ -z "${py}" ]]; then
[[ -n "${verbose}" ]] & echo desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
else
[[ -n "${verbose}" ]] & echo ${py} ${DESIUTIL}/bin/desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
${py} ${DESIUTIL}/bin/desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
fi
[[ -n "${verbose}" ]] && echo /bin/rm -rf ${DESIUTIL}
/bin/rm -rf ${DESIUTIL}

0 comments on commit b202433

Please sign in to comment.