11#! /usr/bin/env bash
2- # > +----------------------+
3- # > | pyenv_setup .sh |
4- # > +----------------------+
2+ # > +--------------------------- +
3+ # > | language_package .sh |
4+ # > +--------------------------- +
55# -
66# - SYNOPSIS
77# -
8- # - ./pyenv_setup.sh [-h]
8+ # - ./language_package.sh [-h]
9+ # -
10+ # - It will intatll Language Packages below:
11+ # - Python : pyenv, pipenv
12+ # - NodeJS : nvm
913# -
1014# - OPTIONS
1115# -
1418# -
1519# - EXAMPLES
1620# -
17- # - $ ./pyenv_setup .sh -y
21+ # - $ ./language_package .sh -y
1822
1923# ====================================================
2024# Part 1. Option Tool
2125# ====================================================
2226# Print script help
2327function show_script_help(){
2428 echo
25- head -17 $0 | # find this file top 16 lines.
29+ head -22 $0 | # find this file top 16 lines.
2630 grep " ^#[-|>]" | # show the line that include "#-" or "#>".
2731 sed -e " s/^#[-|>]*//1" # use nothing to replace "#-" or "#>" that the first keyword in every line.
2832 echo
@@ -89,7 +93,7 @@ function Ask_yn(){
8993# ====================================================
9094# Part 2. Main
9195# ====================================================
92- Keyword =' export PYENV_ROOT="$HOME/.pyenv"
96+ pyenv_Keyword =' export PYENV_ROOT="$HOME/.pyenv"
9397export PATH="$PYENV_ROOT/bin:$PATH"
9498if command -v pyenv 1>/dev/null 2>&1; then
9599 eval "$(pyenv init -)"
@@ -111,21 +115,31 @@ case $SHELL in
111115 Echo_Color r " Unknow shell, need to manually add pyenv config on your shell profile!!"
112116 ;;
113117esac
114- # sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
115- sudo apt-get update
116- sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
117- git clone https://github.com/pyenv/pyenv.git ~ /.pyenv
118118
119- # config profile
120- Ask_yn " Do you want automatic add pyenv config?" ; result=$?
119+ Ask_yn " Do you want to install pyenv" ; result=$?
121120if [ $result = 1 ]; then
122- if grep -xn " $Keyword " $profile ; then
121+ sudo apt-get update
122+ sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
123+ git clone https://github.com/pyenv/pyenv.git ~ /.pyenv
124+
125+ if [ " $( grep -xn " $pyenv_Keyword " $profile ) " != " " ]; then
123126 Echo_Color g " You have already added pyenv config in $profile !!"
124127 else
125- printf " \n# pyenv setting\n$Keyword \n" >> $profile
128+ # config profile
129+ printf " \n# pyenv setting\n$pyenv_Keyword \n" >> $profile
126130 fi
127- Echo_Color g " Done config!!"
128- source $profile
129131fi
130132
133+ Ask_yn " Do you want to install pipenv?" ; result=$?
134+ if [ $result = 1 ]; then
135+ pip install pipenv
136+ fi
137+
138+ Ask_yn " Do you want to install nvm?" ; result=$?
139+ if [ $result = 1 ]; then
140+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | $shell
141+ fi
142+
143+
144+ source $profile
131145Echo_Color g " Done!! $0 "
0 commit comments