Skip to content

Commit

Permalink
add __uninstall__ for get.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihe774 committed May 26, 2017
1 parent fd89ef0 commit 8ffb52a
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions scripts/get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@
# usage: bash <(curl -s <my location>) [[mirror:]branch] [commit/__install_only__]

set -o pipefail

if [ 0 -ne "$(id -u)" ]
then
sudoprefix=sudo
else
sudoprefix=
fi

remote_get_content(){
if curl --version >/dev/null 2>&1
then
curl -fsSL "$1"
elif wget --version >/dev/null 2>&1
then
wget -q "$1" -O -
fi
}

if [ "$1" = "__uninstall__" ]
then
# uninstall
makefile=$(remote_get_content https://github.com/tboox/xmake/raw/master/makefile)
while which xmake >/dev/null 2>&1
do
pre=$(which xmake | sed 's/\/bin\/xmake$//')
# don't care if make exists -- if there's no make, how xmake built and installed?
echo "$makefile" | make -f - uninstall prefix="$pre" 2>/dev/null || echo "$makefile" | $sudoprefix make -f - uninstall prefix="$pre" || exit $?
done
exit
fi

# below is installation
# print a LOGO!
echo ' _ '
echo ' __ ___ __ __ __ _| | ______ '
Expand All @@ -17,12 +49,6 @@ then
brew --version >/dev/null 2>&1 && brew install --HEAD xmake && xmake --version && exit
fi

if [ 0 -ne "$(id -u)" ]
then
sudoprefix=sudo
else
sudoprefix=
fi
my_exit(){
rv=$?
if [ "x$1" != x ]
Expand Down

0 comments on commit 8ffb52a

Please sign in to comment.