-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathsetup
executable file
·44 lines (35 loc) · 1.25 KB
/
setup
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
#!/bin/bash
set -e
elixirs_key="elixir-$ELIXIR_VERSION-erlang-$ERLANG_VERSION-elixirs"
archives_key="elixir-$ELIXIR_VERSION-erlang-$ERLANG_VERSION-archives"
elixirs_path=~/".kiex/elixirs"
archives_path=~/".kiex/mix/archives"
rm -rf "$elixirs_path"/*
rm -rf "$archives_path"/*
EXPECTED_ERLANG_VERSION="26.0"
if [[ "$ERLANG_VERSION" == "$EXPECTED_ERLANG_VERSION" && $(cache has_key "v2-erlang-$ERLANG_VERSION") ]]; then
cache restore "v2-erlang-$ERLANG_VERSION"
fi
sem-version erlang "$ERLANG_VERSION"
if [ "$ERLANG_VERSION" == "$EXPECTED_ERLANG_VERSION" ]; then
cache store "v2-erlang-$ERLANG_VERSION" /home/semaphore/.kerl
fi
erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell
if [ $ELIXIR_VERSION != "main" ] && \
cache has_key "$elixirs_key" && \
cache has_key "$archives_key"
then
cache restore "$elixirs_key"
cache restore "$archives_key"
else
kiex install $ELIXIR_VERSION
cache store "$elixirs_key" "$elixirs_path"
cache store "$archives_key" "$archives_path"
fi
kiex use $ELIXIR_VERSION
elixir -v
mix local.rebar
mix local.hex --force
mix deps.get
# Unset exit on error so the shell is usable after running this script
set +e