forked from subscan-explorer/subscan-essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·43 lines (37 loc) · 823 Bytes
/
build.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
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASENAME="subscan"
app=${BASENAME}
function build() {
go build -o ./cmd/subscan -v ./cmd
echo "Build Success"
}
function install() {
if [[ "$2" == "" ]]; then
echo "empty plugin url!"
return
fi
git clone "$1" tmp/"$2"
if [[ $? -ne 0 ]]; then
exit $?
fi
cd tmp/"$2"
go build -buildmode=plugin -o ${DIR}/configs/plugins/"$2".so
if [[ $? -ne 0 ]]; then
exit $?
fi
echo "Build" ${DIR}/configs/plugins "Success"
rm -rf ${DIR}/tmp
}
function help() {
echo "usage: ./build.sh build|install[repository][pluginName]"
}
if [[ "$1" == "" ]]; then
help
elif [[ "$1" == "build" ]];then
build
elif [[ "$1" == "install" ]];then
install $2 $3
else
help
fi