-
Notifications
You must be signed in to change notification settings - Fork 0
/
xlw
executable file
·49 lines (39 loc) · 1.08 KB
/
xlw
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
48
49
#!/usr/bin/env bash
##############################################################################
##
## XL Cli wrapper script for Linux/Darwin
##
##############################################################################
set -e
# detecting program dir
PROG_DIR="$(cd "$(dirname "${0:-$PWD}")" 2>/dev/null 1>&2 && pwd)"
source "${PROG_DIR}/xl/wrapper/wrapper.conf"
XL_WRAPPER_HOME="${HOME}/.xebialabs/wrapper/${CLI_VERSION}"
# checking OS
BINARY_TYPE="unknown"
case "`uname`" in
Darwin* )
BINARY_TYPE="darwin-amd64"
;;
Linux* )
BINARY_TYPE="linux-amd64"
;;
esac
if [ ${BINARY_TYPE} = "unknown" ] ; then
echo "Unsupported OS `uname`"
exit 1
fi
# find target location
if [ ! -d "${XL_WRAPPER_HOME}" ] ; then
mkdir -p "${XL_WRAPPER_HOME}"
fi
# if xl does not exist download it
XL_BIN="${XL_WRAPPER_HOME}/xl"
if [ ! -f "${XL_BIN}" ] ; then
echo "Downloading xl binary to ${XL_BIN}"
curl -fLso "${XL_BIN}.$$" "${CLI_BASE_URL}/${CLI_VERSION}/${BINARY_TYPE}/xl"
chmod +x "${XL_BIN}.$$"
mv "${XL_BIN}.$$" "${XL_BIN}"
fi
# now run xl cli
exec "${XL_BIN}" "$@"