-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscala-setup.sh
executable file
·57 lines (45 loc) · 1.21 KB
/
scala-setup.sh
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
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -eu
SCALA_CLI_VERSION="1.6.1"
if [ $# -ge 1 ] && [ "$1" = "--version" ] ; then
shift
if [ $# -ge 1 ] ; then
SCALA_CLI_VERSION="$1"
shift
fi
fi
SCALA_CLI_BASE_URL="https://github.com/VirtusLab/scala-cli/releases/download/v$SCALA_CLI_VERSION"
UNAME="$(uname)"
OS_ARCH="x86_64"
architecture() {
case "$UNAME" in
Linux)
OS_NAME=pc-linux
if [ "$(uname -m)" = "aarch64" ]; then
OS_ARCH="aarch64"
fi
;;
Darwin)
OS_NAME=apple-darwin
;;
*)
printf "unrecognized OS type: $UNAME\n"
exit 1
;;
esac
}
architecture
URL="${SCALA_CLI_BASE_URL}/scala-cli-${OS_ARCH}-${OS_NAME}.gz"
TMP_DIR="$(mktemp -d)"
SCALA_CLI_ARCHIVE="${TMP_DIR}/scala-cli.gz"
SCALA_CLI_BIN_FILE="${TMP_DIR}/scala-cli"
curl -fLo ${SCALA_CLI_ARCHIVE} $URL
gzip -d ${SCALA_CLI_ARCHIVE}
chmod +x ${SCALA_CLI_BIN_FILE}
if [ -t 1 ]; then
# stdout is a tty
"${SCALA_CLI_BIN_FILE}" install-home --scala-cli-binary-path ${SCALA_CLI_BIN_FILE} "$@" < /dev/tty
else
"${SCALA_CLI_BIN_FILE}" install-home --scala-cli-binary-path ${SCALA_CLI_BIN_FILE} "$@"
fi
rm ${SCALA_CLI_BIN_FILE}