-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·43 lines (32 loc) · 893 Bytes
/
install.sh
File metadata and controls
executable file
·43 lines (32 loc) · 893 Bytes
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
#!/bin/bash
cp -v tool-versions ~/.tool-versions
cp -v bashrc ~/.bashrc
cd ~
if [ ! -e .tool-versions ]; then
echo "No .tool-versions file found!"
exit 1
fi
export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
if ! command -v asdf &> /dev/null; then
if [[ -x $ASDF_DATA_DIR/bin/asdf ]]; then
export PATH="$ASDF_DATA_DIR/bin:$PATH"
fi
fi
if [[ -e $ASDF_DATA_DIR/shims ]]; then
export PATH="$ASDF_DATA_DIR/shims:$PATH"
fi
set -e
REQUIRED_PLUGINS=$(cat .tool-versions | cut -d \ -f 1)
INSTALLED_PLUGINS=$(asdf plugin list || echo "")
for PLUGIN in $REQUIRED_PLUGINS; do
if [[ $INSTALLED_PLUGINS =~ (^|[[:space:]])"$PLUGIN"($|[[:space:]]) ]]; then
echo "Updating $PLUGIN ASDF plugin..."
asdf plugin update $PLUGIN
echo " ...done"
else
echo "Installing $PLUGIN ASDF plugin..."
asdf plugin add $PLUGIN
echo " ...done"
fi
done
asdf install