diff options
| author | ruki <[email protected]> | 2017-06-02 17:17:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-06-02 17:17:23 +0800 |
| commit | dfa254235f3d7a7940f7ca5beebdb275f20e8a34 (patch) | |
| tree | c31d7a49b78353b8d49c59efa926b21e8c0418d6 /scripts | |
| parent | d286b56882819b7e7cdcbef24196cdf4ef21fc99 (diff) | |
fix .bash_profile cannot be loaded when open a new terminal on linux
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/get.sh | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/scripts/get.sh b/scripts/get.sh index 3a1fabd21..e4a9bf172 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -124,43 +124,32 @@ then my_exit "$(echo -e 'Build Fail\nDetail:\n' | cat - /tmp/xmake.out)" $rv fi fi -# PATHclone=$PATH -# patharr=($PATHclone) + if [ "$prefix" = "" ] then prefix=~/.local fi -# for st in "${patharr[@]}" -# do -# if [[ "$st" = "$HOME"* ]] -# then -# cwd=$PWD -# mkdir -p "$st" -# cd "$st" || continue -# echo $$ > $$xmake_getter_test 2>/dev/null || continue -# rm $$xmake_getter_test 2>/dev/null || continue -# cd .. || continue -# mkdir -p share 2>/dev/null || continue -# prefix=$(pwd) -# cd "$cwd" || my_exit 'Chdir Error' -# break -# fi -# done + if [ "x$prefix" != x ] then make -C /tmp/$$xmake_getter --no-print-directory install prefix="$prefix"|| my_exit 'Install Fail' else $sudoprefix make -C /tmp/$$xmake_getter --no-print-directory install || my_exit 'Install Fail' fi -shell_profile(){ - if [[ "$SHELL" = */zsh ]]; then echo ~/.zshrc - elif [[ "$SHELL" = */ksh ]]; then echo ~/.kshrc - else echo ~/.bash_profile; fi +install_profile(){ + profile="[[ -s \"\$HOME/.xmake/profile\" ]] && source \"\$HOME/.xmake/profile\" # load xmake 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 + fi + echo $profile >> ~/.bash_profile } if xmake --version >/dev/null 2>&1; then xmake --version; else - echo "export PATH=$prefix/bin:\$PATH" >> "$(shell_profile)" export PATH=$prefix/bin:$PATH xmake --version + install_profile echo "Reload shell profile by running the following command now!" - echo -e "\x1b[1msource '$(shell_profile)'\x1b[0m" + echo -e "\x1b[1msource ~/.xmake/profile\x1b[0m" fi |
