-
Notifications
You must be signed in to change notification settings - Fork 3
/
build
executable file
·57 lines (53 loc) · 1.38 KB
/
build
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/bash
action=$1
function setversion() {
info="$1"
codefile=$2
read -p "$info" version
echo "${version}" > LATEST
sed -i "/const VERSION/c\const VERSION = \"$version\"" "$codefile"
}
function compile_pigger() {
setversion "Version number for pigger: " main.go
echo "[+] Install pigger to local ..."
packr
go install
echo "[+] Cross compile pigger for linux, windows and mac ..."
gox -output="release/pigger_{{.OS}}_{{.Arch}}" -os="linux windows darwin" -arch="amd64 386"
packr clean
echo "Compile pigger is done!"
}
function compile_pigmgr() {
cd pigmgr
setversion "Version number for pigmgr: " main.go
echo "[+] Install pigmgr to local ..."
go install
echo "[+] Cross compile pigmgr for linux, windows and mac ..."
gox -output="../release/pigmgr_{{.OS}}_{{.Arch}}" -os="linux windows darwin" -arch="amd64 386"
echo "Compile pigmgr is done!"
}
case $action in
dev)
echo "[+] Install pigger to local ..."
packr
go install
packr clean
echo "[+] Install pigmgr to local ..."
cd pigmgr
go install
echo "All is done!"
;;
pigger)
compile_pigger
;;
pigmgr)
compile_pigmgr
;;
all)
compile_pigger
compile_pigmgr
;;
*)
echo "Usage: $0 {dev|pigger|pigmgr|all}"
exit 1
esac