Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
QLeelulu committed Apr 3, 2021
1 parent d5f25fd commit 9015e15
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
vendor/

bin/
dist/
*.zip
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export CGO_ENABLED=0

go build -o ./bin/fpdns main.go
GOOS=linux GOARCH=amd64 go build -o ./bin/fpdns_linux_amd64 main.go
GOOS=linux GOARCH=arm go build -o ./bin/fpdns_linux_arm7 main.go
GOOS=darwin GOARCH=amd64 go build -o ./bin/fpdns_mac_amd64 main.go
GOOS=linux GOARCH=arm go build -o ./bin/fpdns_linux_arm main.go
GOOS=darwin GOARCH=amd64 go build -o ./bin/fpdns_darwin_amd64 main.go
GOOS=windows GOARCH=amd64 go build -o ./bin/fpdns_windows_amd64.exe main.go
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
_ "net/http/pprof"
"os"
"os/signal"
Expand Down Expand Up @@ -33,8 +34,9 @@ func parseFlag() {
flag.Parse()

if confDir == "" {
fmt.Println("配置目录 conf_dir 参数必须指定")
flag.Usage()
panic("配置目录 conf_dir 参数必须指定")
os.Exit(1)
}
}

Expand Down
39 changes: 39 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

version=v0.1
if [[ $# -gt 0 ]]; then
version="$1"
fi

rm -rf dist/*
mkdir -p dist/conf/k8s
cp conf/k8s/qa-k8s.dns-conf ./dist/conf/k8s/
cp conf/mydomain.com.dns-conf ./dist/conf/
cp conf/test.dns-conf ./dist/conf/
cp conf/resolv.conf ./dist/conf/

sh build.sh

declare -a goos=(
linux-arm
linux-amd64
darwin-amd64
windows-amd64
)

for osarch in "${goos[@]}"; do
IFS='-' #setting comma as delimiter
read -a osarchIN <<<"$osarch" #reading str as an array as tokens separated by IFS
export GOOS=${osarchIN[0]} GOARCH=${osarchIN[1]}
echo building $GOOS-$GOARCH
binName="fpdns_${GOOS}_${GOARCH}"
if [ "$GOOS" = "windows" ]; then
binName="fpdns_${GOOS}_${GOARCH}.exe"
fi
cp -r dist fpdns-$version
cp bin/$binName fpdns-$version/fpdns
rm -f fpdns-$version-$GOOS-$GOARCH.zip
7z a fpdns-$version-$GOOS-$GOARCH.zip fpdns-$version
rm -rf fpdns-$version
echo
done

0 comments on commit 9015e15

Please sign in to comment.