-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-asdf.sh
executable file
·47 lines (41 loc) · 1.34 KB
/
install-asdf.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
#!/bin/bash
function check_distro() {
. /etc/os-release
distro_name="unknown"
case "${NAME}" in
"Rocky Linux" ) distro_name="rockylinux" ;;
"Ubuntu" ) distro_name="ubuntu" ;;
esac
echo "${distro_name}"
}
distro_name=$(check_distro)
# dependencies install
if [[ "${distro_name}" == "rockylinux" ]]; then
sudo dnf -y update
sudo dnf -y install curl git \
make gcc zlib-devel bzip2 bzip2-devel readline-devel \
sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel
elif [[ "${distro_name}" == "ubuntu" ]]; then
sudo apt-get update
sudo apt-get install --no-install-recommends curl git \
make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
libffi-dev liblzma-dev
else
echo "distro: ${distro_name} is unsupported"
exit 1
fi
# check to see if asdf is installed.
if [[ -d ${HOME}/.asdf ]]; then
echo "already installed asdf. skip install asdf from github"
else
# install asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0
fi
# enable pyenv
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
. ~/.bashrc
# install asdf plugin for python
asdf plugin-add python