forked from ecmwf-ifs/dwarf-p-cloudsc2-tl-ad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudsc-bundle
executable file
·42 lines (34 loc) · 1.13 KB
/
cloudsc-bundle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# BOOTSTRAP ecbundle-build or ecbundle-create,
# and pass arguments to it.
# Check at least one argument was provided:
if [[ $# -eq 0 ]]; then
echo "FAIL: At least one argument expected: 'build' or 'create'"
exit 1
fi
export ecbundle_VERSION=develop
# Which script do we run?
# Partial matches are accepted, e.g. "$0 cr"
if [[ "build" == "$1"* ]]; then
BOOTSTRAPPED=${ECBUNDLE_DIR}ecbundle-build
elif [[ "create" == "$1"* ]]; then
BOOTSTRAPPED=${ECBUNDLE_DIR}ecbundle-create
else
echo "FAIL: Expected 'build' or 'create' as first argument"
exit 1
fi
shift
BUNDLE_DIR="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"
if [[ -z "${BITBUCKET}" ]]; then
export BITBUCKET=ssh://[email protected]
fi
# Download ecbundle scripts if not already available
command_exists () { type "$1" &> /dev/null ; }
if ! command_exists ${BOOTSTRAPPED} ; then
if [[ ! -d ${BUNDLE_DIR}/ecbundle ]]; then
git clone ${BITBUCKET}/escape/ecbundle.git ${BUNDLE_DIR}/ecbundle
( cd ${BUNDLE_DIR}/ecbundle && git checkout ${ecbundle_VERSION} )
fi
export PATH=${BUNDLE_DIR}/ecbundle/bin:${PATH}
fi
${BOOTSTRAPPED} "$@"