Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions build-coatjava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GENERAL OPTIONS

DATA RETRIEVAL OPTIONS
How to retrieve magnetic field maps, neural network models, etc.;
choose only one:
choose only one, e.g., if the automated default choice fails:
--lfs use Git Large File Storage (requires `git-lfs`)
--cvmfs use CernVM-FS (requires `/cvfms`)
--xrootd use XRootD (requires `xrootd`)
Expand Down Expand Up @@ -80,10 +80,34 @@ do
esac
done

# Currently only git-lfs works from offsite:
if ! [[ $(hostname) == *.jlab.org ]]; then
echo "INFO: using --lfs for offsite usage"
# count how many data-retrieval options are set
count_download_opts() {
local n=0
for o in $useLfs $useCvmfs $useXrootd; do
$o && ((n++))
done
echo $n
}

# if the user did not choose a data retrieval method, choose a reasonable one
if [[ $(count_download_opts) -eq 0 ]]; then
echo 'INFO: no data-retrieval option set; choosing a default...'
if ! [[ $(hostname) == *.jlab.org ]]; then
echo 'INFO: ... using `--lfs` since you are likely offsite'
useLfs=true
elif [ -d /cvmfs ]; then
echo 'INFO: ... using `--cvmfs` since you are likely onsite and have /cvmfs'
useCvmfs=true
else
echo 'WARNING: default data-retrieval option cannot be determined; use `--help` for guidance' >&2
sleep 1
fi
fi

# if they chose too many, fail
if [[ $(count_download_opts) -gt 1 ]]; then
echo 'ERROR: more than one data-retrieval option is set' >&2
exit 1
fi


Expand Down