summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-25 07:44:04 +0800
committerTitanSnow <[email protected]>2017-05-25 07:44:04 +0800
commit7ee82c2b09ee0af9289c2aad852707bd7d2e637b (patch)
treec215e232e2ba8f92d449b62b204b52b3e6682c61
parenta00ed183e738749f8c5068a3fe56dab54b4fb961 (diff)
fix chaos installation
-rw-r--r--makefile2
-rwxr-xr-xscripts/get.sh53
2 files changed, 33 insertions, 22 deletions
diff --git a/makefile b/makefile
index 4edf55d86..723fe67f7 100644
--- a/makefile
+++ b/makefile
@@ -68,8 +68,6 @@ install:
@if [ ! -d $(prefix)/bin ]; then mkdir -p $(prefix)/bin; fi
@mv $(xmake_loader) $(xmake_loader_install)
@chmod 777 $(xmake_loader_install)
- @# tip
- @$(if $(findstring $(prefix)/bin,$(PATH)),,echo 'please export PATH=$$PATH:$(prefix)/bin')
@# remove xmake.out
@if [ -f '/tmp/xmake.out' ]; then rm /tmp/xmake.out; fi
@# ok
diff --git a/scripts/get.sh b/scripts/get.sh
index e780b34cf..f4c605bdc 100755
--- a/scripts/get.sh
+++ b/scripts/get.sh
@@ -98,29 +98,42 @@ then
my_exit 'Build Fail' $rv
fi
fi
-PATHclone=$PATH
-patharr=($PATHclone)
-prefix=
-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
+# 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
-xmake --version
+shell_profile(){
+ if [[ "$SHELL" = */zsh ]]; then echo ~/.zshrc
+ elif [[ "$SHELL" = */ksh ]]; then echo ~/.kshrc
+ else echo ~/.bash_profile; fi
+}
+xmake --version >/dev/null 2>&1 && xmake --version || {
+ echo "export PATH=$prefix/bin:\$PATH" >> $(shell_profile)
+ export PATH=$prefix/bin:$PATH
+ xmake --version
+ echo -e "Reload shell profile by running \x1b[1msource '$(shell_profile)'\x1b[0m now!"
+}