forked from sipt/shuttle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·40 lines (36 loc) · 1.11 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·40 lines (36 loc) · 1.11 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
38
39
40
#!/usr/bin/env bash
# ./build.sh mac|win|linux
if [ ! -d "_output/" ];then
mkdir _output
fi
if [ ! -d "_output/shuttle" ];then
mkdir _output/shuttle
else
rm -rf _output/shuttle/*
fi
cp -rf view _output/shuttle/
cp GeoLite2-Country.mmdb _output/shuttle/
#if [ -d ".conf/" ];then
#cp .conf/sipt.yaml _output/shuttle.yaml
#else
cp example.yaml _output/shuttle/shuttle.yaml
#fi
if [ "$1" == "mac" ];then
# mac os
GOOS=darwin GOARCH=amd64 go build -o _output/shuttle/shuttle cmd/main.go
`echo "nohup ./shuttle >> shuttle.log 2>&1 &" > _output/shuttle/start.sh`
`chmod a+x _output/shuttle/start.sh`
elif [ "$1" == "win" ];then
# windows
GOOS=windows GOARCH=amd64 go build -o _output/shuttle/shuttle.exe cmd/main.go
`echo "@echo off
if \"%1\" == \"h\" goto begin
mshta vbscript:createobject(\"wscript.shell\").run(\"%~nx0 h\",0)(window.close)&&exit
:begin
shuttle >> shuttle.log" > _output/shuttle/startup.bat`
elif [ "$1" == "linux" ];then
# linux
GOOS=linux GOARCH=amd64 go build -o _output/shuttle/shuttle cmd/main.go
`echo "nohup ./shuttle >> shuttle.log 2>&1 &" > _output/shuttle/start.sh`
`chmod a+x _output/shuttle/start.sh`
fi