From 2d461141f5a6cc15fcc4147be02e106254441035 Mon Sep 17 00:00:00 2001 From: Opportunity Date: Tue, 21 Jan 2020 10:24:37 +0800 Subject: [PATCH] install with run file --- scripts/get.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/get.sh b/scripts/get.sh index 5046d9e0f20..3f29fc861de 100755 --- a/scripts/get.sh +++ b/scripts/get.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # xmake getter -# usage: bash <(curl -s ) [[mirror:]branch] [commit/__install_only__] +# usage: bash <(curl -s ) [[mirror:]branch|__local__|__run__] [commit/__install_only__] set -o pipefail @@ -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 @@ -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' @@ -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