Skip to content

Commit

Permalink
install with run file
Browse files Browse the repository at this point in the history
  • Loading branch information
OpportunityLiu committed Jan 21, 2020
1 parent fac3a78 commit 2d46114
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions scripts/get.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# xmake getter
# usage: bash <(curl -s <my location>) [[mirror:]branch] [commit/__install_only__]
# usage: bash <(curl -s <my location>) [[mirror:]branch|__local__|__run__] [commit/__install_only__]

set -o pipefail

Expand Down Expand Up @@ -97,7 +97,7 @@ install_tools()
{ apk --version >/dev/null 2>&1 && $sudoprefix apk add gcc g++ make readline-dev ncurses-dev libc-dev linux-headers; }
}
test_tools || { install_tools && test_tools; } || my_exit "$(echo -e 'Dependencies Installation Fail\nThe getter currently only support these package managers\n\t* apt\n\t* yum\n\t* zypper\n\t* pacman\nPlease install following dependencies manually:\n\t* git\n\t* build essential like `make`, `gcc`, etc\n\t* libreadline-dev (readline-devel)\n\t* ccache (optional)')" 1
branch=master
branch=__run__
mirror=xmake-io
IFS=':'
if [ x != "x$1" ]; then
Expand All @@ -114,7 +114,24 @@ if [ x != "x$1" ]; then
echo "Branch: $branch"
fi
projectdir=$tmpdir
if [ 'x__local__' != "x$branch" ]; then
if [ 'x__local__' == "x$branch" ]; then
if [ -d '.git' ]; then
git submodule update --init --recursive
fi
cp -r . $projectdir
cd $projectdir || my_exit 'Chdir Error'
else if [ 'x__run__' == "x$branch" ]; then
version=$(git ls-remote --tags https://github.com/$mirror/xmake | tail -c 7)
if xz --version >/dev/null 2>&1
then
pack=xz
else
pack=gz
fi
mkdir -p $projectdir
remote_get_content https://github.com/$mirror/xmake/releases/download/$version/xmake-$version.$pack.run > $projectdir/xmake.run
sh $projectdir/xmake.run --noexec --target $projectdir
else
if [ x != "x$2" ]; then
git clone --depth=50 -b "$branch" "https://github.com/$mirror/xmake.git" --recurse-submodules $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')"
cd $projectdir || my_exit 'Chdir Error'
Expand All @@ -123,12 +140,6 @@ if [ 'x__local__' != "x$branch" ]; then
else
git clone --depth=1 -b "$branch" "https://github.com/$mirror/xmake.git" --recurse-submodules $projectdir || my_exit "$(echo -e 'Clone Fail\nCheck your network or branch name')"
fi
else
if [ -d '.git' ]; then
git submodule update --init --recursive
fi
cp -r . $projectdir
cd $projectdir || my_exit 'Chdir Error'
fi

# do build
Expand Down

0 comments on commit 2d46114

Please sign in to comment.