diff options
| author | ruki <[email protected]> | 2017-06-02 20:22:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-02 20:22:58 +0800 |
| commit | e75933b3a3188b9b1a27c5934d6c3f62cc57b040 (patch) | |
| tree | 8659dead446c29dd2c69e7e11a397a0c3fca76a9 /docs | |
| parent | 853d9feb93f043c7dd149547d9ea496dd4a748d0 (diff) | |
update get.sh to docs
Diffstat (limited to 'docs')
| -rwxr-xr-x | docs/get.sh | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/docs/get.sh b/docs/get.sh index 7e56dea3d..204234d58 100755 --- a/docs/get.sh +++ b/docs/get.sh @@ -136,20 +136,24 @@ then else $sudoprefix make -C /tmp/$$xmake_getter --no-print-directory install || my_exit 'Install Fail' fi -install_profile(){ - profile="[[ -s \"\$HOME/.xmake/profile\" ]] && source \"\$HOME/.xmake/profile\"" +write_profile() +{ + grep -sq ".xmake/profile" $1 || echo "[[ -s \"\$HOME/.xmake/profile\" ]] && source \"\$HOME/.xmake/profile\" # load xmake profile" >> $1 +} +install_profile() +{ if [ ! -d ~/.xmake ]; then mkdir ~/.xmake; fi echo "export PATH=$prefix/bin:\$PATH" > ~/.xmake/profile - if [[ "$SHELL" = */zsh ]]; then echo $profile >> ~/.zshrc - elif [[ "$SHELL" = */ksh ]]; then echo $profile >> ~/.kshrc - elif [[ "$SHELL" = */bash ]]; then echo $profile >> ~/.bashrc + if [[ "$SHELL" = */zsh ]]; then write_profile ~/.zshrc + elif [[ "$SHELL" = */ksh ]]; then write_profile ~/.kshrc + elif [[ "$SHELL" = */bash ]]; then write_profile ~/.bashrc fi - echo $profile >> ~/.bash_profile + write_profile ~/.bash_profile } +install_profile if xmake --version >/dev/null 2>&1; then xmake --version; else - export PATH=$prefix/bin:$PATH + source ~/.xmake/profile xmake --version - install_profile echo "Reload shell profile by running the following command now!" echo -e "\x1b[1msource ~/.xmake/profile\x1b[0m" fi |
