-
Notifications
You must be signed in to change notification settings - Fork 22
/
cloudsc-bundle
executable file
·47 lines (38 loc) · 1.43 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
43
44
45
46
47
#!/usr/bin/env bash
# (C) Copyright 1988- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
# 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=2.0.0
# 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 )"
# 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 https://github.com/ecmwf/ecbundle.git ${BUNDLE_DIR}/ecbundle
( cd ${BUNDLE_DIR}/ecbundle && git checkout ${ecbundle_VERSION} )
fi
export PATH=${BUNDLE_DIR}/ecbundle/bin:${PATH}
fi
${BOOTSTRAPPED} "$@"