summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-02 17:17:23 +0800
committerruki <[email protected]>2017-06-02 17:17:23 +0800
commitdfa254235f3d7a7940f7ca5beebdb275f20e8a34 (patch)
treec31d7a49b78353b8d49c59efa926b21e8c0418d6
parentd286b56882819b7e7cdcbef24196cdf4ef21fc99 (diff)
fix .bash_profile cannot be loaded when open a new terminal on linux
-rw-r--r--.travis.yml2
-rwxr-xr-xdocs/get.sh37
-rwxr-xr-xscripts/get.sh37
3 files changed, 27 insertions, 49 deletions
diff --git a/.travis.yml b/.travis.yml
index 3ceb81d09..e7e12f2b2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,7 @@ install:
script:
- scripts/get.sh __local__
- - source ~/.bash_profile
+ - source ~/.xmake/profile
- xmake lua versioninfo
- xmake f -m coverage -P core
- xmake -P core
diff --git a/docs/get.sh b/docs/get.sh
index 3a1fabd21..7e56dea3d 100755
--- a/docs/get.sh
+++ b/docs/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\""
+ 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
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