-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildmtg.sh
34 lines (34 loc) · 1.33 KB
/
buildmtg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if [[ ! -e /tmp/go ]]; then
apt-get install -y git gcc automake autoconf libtool make psmisc
go_download_link=$(wget -qO- "https://golang.org/dl/" | sed -n '/class="download downloadBox"/,+1 s/.*href="\([^"]*\).*$/\1/p' | grep "linux-amd64")
wget -N --no-check-certificate ${go_download_link}
tar -xf go*linux-amd64.tar.gz && rm -f go*linux-amd64.tar.gz
mv go /tmp/go
mkdir /tmp/gopath
fi
export GOROOT=/tmp/go
export GOPATH=/tmp/gopath
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
echo -e "go 版本:\c" && cat "/tmp/go/VERSION" && echo -e " "
[[ ! -e /tmp/mtg ]] && git clone -b master https://github.com/9seconds/mtg.git /tmp/mtg
cd /tmp/mtg
git reset --hard
git pull
rm -rf /tmp/gopath/pkg
go mod download
echo -e "开始编译" && echo -e " "
make crosscompile
[[ ! -e /tmp/onekeymakemtg ]] && git clone -b master https://github.com/whunt1/onekeymakemtg.git /tmp/onekeymakemtg
cd /tmp/onekeymakemtg
git reset --hard
git pull
mv -f /tmp/mtg/ccbuilds /tmp/onekeymakemtg/builds
git config user.email "[email protected]"
git config user.name "whunt1"
git add .
current_time=$(date "+%Y-%m-%d %H:%M:%S")
git commit -m "${current_time}"
store_enable=$(cat /tmp/onekeymakemtg/.git/config | grep store)
[[ -z ${store_enable} ]] && echo "[credential]
helper = store" >> /tmp/onekeymakemtg/.git/config
git push -u origin master