-
Notifications
You must be signed in to change notification settings - Fork 120
/
install
executable file
·56 lines (42 loc) · 1.66 KB
/
install
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
#!/usr/bin/env bash
# Unoffical Bash "strict mode"
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
#ORIGINAL_IFS=$IFS
IFS=$'\t\n' # Stricter IFS settings
# shellcheck source=lib/utils.sh
source "$(dirname "$0")/../lib/utils.sh"
install_erlang() {
ensure_kerl_setup
local build_name
build_name="asdf_$ASDF_INSTALL_VERSION"
export MAKEFLAGS="-j$ASDF_CONCURRENCY"
$(kerl_path) delete installation "$build_name" || true
$(kerl_path) delete build "$build_name" || true
if [ "$ASDF_INSTALL_TYPE" = "ref" ]; then
$(kerl_path) build git "${OTP_GITHUB_URL:-https://github.com/erlang/otp.git}" "$ASDF_INSTALL_VERSION" "$build_name"
else
$(kerl_path) build "$ASDF_INSTALL_VERSION" "$build_name"
fi
# We hide all output from this command so the
# "You can activate this installation running the following command:"
# that doesn't apply is hidden
$(kerl_path) install "$build_name" "$ASDF_INSTALL_PATH" >/dev/null 2>&1
$(kerl_path) cleanup "$build_name"
link_app_executables "$ASDF_INSTALL_PATH"
}
link_app_executables() {
local install_path=$1
# Link other executables to the bin directory so that asdf shims are created for them
cd "$install_path/bin"
# ln call may fail if multiple executables are found with the same name, so
# we loop over all files matching these patterns, and symlink only if
# file with same name does not already exist in "$install_path/bin"
for file in ../lib/*/bin/* ../lib/*/priv/bin/*; do
bin_name="$(basename "$file")"
if [ ! -e "./$bin_name" ]; then
ln -s "$file" .
fi
done
}
install_erlang