-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·39 lines (30 loc) · 1.02 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·39 lines (30 loc) · 1.02 KB
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
#!/usr/bin/env bash
#set -x
appname='scan'
### build ####
echo "start build ..."
#Mac
# go build -o ./bin/$appname ./src/main.go && (echo "BUILD SUCCESS"; exit 0;) || (echo "BUILD FAILED" && exit 1);
#linux
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ./bin/$appname ./src/main.go && (echo "BUILD SUCCESS"; exit 0;) || (echo "BUILD FAILED" && exit 1);
# xgo -x -targets=linux/amd64 ./src/ && (mv src-linux-amd64 ./bin/$appname; echo "BUILD SUCCESS"; exit 0;) || (echo "BUILD FAILED" && exit 1) || exit 1;
dir=$(pwd)
echo "initalize ..."
echo "rm $dir/output"
rm -rf $dir/output/ 2>&1 > /dev/null
mkdir -p output/bin
mkdir -p output/conf
mkdir -p output/log
mkdir -p output/logs
### copy files ####
echo "copy to destination dir"
cp -R ./bin/scan output/bin/$appname
cp ./conf/scan.conf.test ./output/conf/
### shell script ####
cp ./load.sh ./output/
### tar ############
echo "tar ..."
cd output
tar -czf $appname.tar.gz ./bin ./conf ./log ./load.sh
mv ./$appname.tar.gz $dir/
rm -r $dir/output/