From ecd522a957d95a37286afca243afe7db305a3630 Mon Sep 17 00:00:00 2001 From: Zic Date: Sat, 23 Dec 2017 23:57:17 +0800 Subject: [PATCH] Add the compress logic. --- build/bin/startup.sh | 12 ++++++++++++ build/pack/build.bat | 11 ++++++++++- build/pack/build.sh | 15 +++++++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 build/bin/startup.sh diff --git a/build/bin/startup.sh b/build/bin/startup.sh new file mode 100644 index 0000000..62ecf90 --- /dev/null +++ b/build/bin/startup.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# executable path +DIR="$( cd "$( dirname "$0" )" && pwd )" +EXE_PATH=$GOPATH/bin/tank + +if [ -f "$EXE_PATH" ]; then + nohup $EXE_PATH >/dev/null 2>&1 & +else + echo 'Cannot find $EXE_PATH.' + exit 1 +fi diff --git a/build/pack/build.bat b/build/pack/build.bat index 8a1b857..2e25089 100644 --- a/build/pack/build.bat +++ b/build/pack/build.bat @@ -15,6 +15,9 @@ if "%GOPATH%"=="" ( set PRE_DIR=%cd% +@rem version name +set VERSION_NAME=tank-1.0.0 + cd %GOPATH% echo golang.org . Please download from: https://github.com/MXi4oyu/golang.org and put in the directory with same level of github.com @@ -47,7 +50,13 @@ echo build tank ... go install tank echo packaging -set distPath=%GOPATH%\src\tank\dist + +set distFolder=%GOPATH%\src\tank\dist +if not exist %distFolder% ( + md %distFolder% +) + +set distPath=%distFolder%\%VERSION_NAME% if exist %distPath% ( echo clear %distPath% rmdir /s/q %distPath% diff --git a/build/pack/build.sh b/build/pack/build.sh index 67ae8bb..25dc3d3 100755 --- a/build/pack/build.sh +++ b/build/pack/build.sh @@ -6,9 +6,10 @@ if [ -z "$GOPATH" ] ; then exit 1 fi - PRE_DIR=$(pwd) +VERSION_NAME=tank-1.0.0 + cd $GOPATH echo "golang.org . Please download from: https://github.com/MXi4oyu/golang.org and put in the directory with same level of github.com" @@ -39,7 +40,14 @@ echo "build tank ..." go install tank echo "packaging..." -distPath="$GOPATH/src/tank/dist" +distFolder="$GOPATH/src/tank/dist" + +# if a directory +if [ ! -d distFolder ] ; then + mkdir $distFolder +fi + +distPath=$distFolder/$VERSION_NAME # if a directory if [ -d $distPath ] ; then @@ -59,6 +67,9 @@ cp -r "$GOPATH/src/tank/build/." $distPath echo "remove pack" rm -rf $distPath/pack +echo "compress to tar.gz" +tar -zcvf $distFolder/$VERSION_NAME.tar.gz $distPath + cd $PRE_DIR echo "check the dist file in $distPath"