forked from p4gefau1t/trojan-go
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrelease.sh
More file actions
39 lines (32 loc) · 900 Bytes
/
release.sh
File metadata and controls
39 lines (32 loc) · 900 Bytes
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
#!/usr/bin/env bash
mkdir -p build
rm -f ./build/*
output="{{.Dir}}-{{.OS}}-{{.Arch}}"
echo "Compiling:"
export GOFLAGS="-trimpath"
os="linux"
arch="amd64"
CGO_ENABLED=0 gox -tags "server" -ldflags="-s -w -buildid=" -os="$os" -arch="$arch" -output="$output-server"
os="linux"
arch="arm64"
CGO_ENABLED=0 gox -tags "client" -ldflags="-s -w -buildid=" -os="$os" -arch="$arch" -output="$output-client"
mv trojan-go-* ./build
cd ./build
FILES=$(find . -type f)
for file in $FILES; do
filename=$(basename "$file")
extension="${filename##*.}"
if [ "$extension" != "zip" ]; then
zip_name=$(basename "$file" ".$extension")
if [ "$extension" == "exe" ]; then
upx -o "trojan.exe" "$file"
zip -q "$zip_name.zip" "trojan.exe"
rm -f trojan.exe
else
upx -o "trojan" "$file"
zip -q "$zip_name.zip" "trojan"
rm -f trojan
fi
rm -f "$file"
fi
done