scripts: strip sensitive gopath string out of release binaries

This commit is contained in:
mappu 2016-04-16 18:18:09 +12:00
parent a52fb3c43d
commit 86723f24ca

View File

@ -7,6 +7,12 @@ export GOPATH=$(
cygpath -w "$(pwd)" cygpath -w "$(pwd)"
) )
sanitise() {
local tmp=$(mktemp)
cat "$1" | perl -pe 's~C:.Users.......Documents.DEV.~C:/xxxxxxxxxxxxxxxxxxxxxxxxx/~g' > "$tmp"
mv "$tmp" "$1"
}
main() { main() {
local version="" local version=""
@ -25,21 +31,25 @@ main() {
echo "Building win64..." echo "Building win64..."
GOARCH=amd64 GOOS=windows go build -a -ldflags -s -o nmdc-log-service.exe GOARCH=amd64 GOOS=windows go build -a -ldflags -s -o nmdc-log-service.exe
sanitise nmdc-log-service.exe
7z a -mx9 nmdc-log-service-${version}-win64.7z nmdc-log-service.exe >/dev/null 7z a -mx9 nmdc-log-service-${version}-win64.7z nmdc-log-service.exe >/dev/null
rm ./nmdc-log-service.exe rm ./nmdc-log-service.exe
echo "Building win32..." echo "Building win32..."
GOARCH=386 GOOS=windows go build -a -ldflags -s -o nmdc-log-service.exe GOARCH=386 GOOS=windows go build -a -ldflags -s -o nmdc-log-service.exe
sanitise nmdc-log-service.exe
7z a -mx9 nmdc-log-service-${version}-win32.7z nmdc-log-service.exe >/dev/null 7z a -mx9 nmdc-log-service-${version}-win32.7z nmdc-log-service.exe >/dev/null
rm ./nmdc-log-service.exe rm ./nmdc-log-service.exe
echo "Building linux64..." echo "Building linux64..."
GOARCH=amd64 GOOS=linux go build -a -ldflags -s -o nmdc-log-service GOARCH=amd64 GOOS=linux go build -a -ldflags -s -o nmdc-log-service
sanitise nmdc-log-service
XZ_OPT=-9 tar caf nmdc-log-service-${version}-linux64.tar.xz nmdc-log-service --owner=0 --group=0 XZ_OPT=-9 tar caf nmdc-log-service-${version}-linux64.tar.xz nmdc-log-service --owner=0 --group=0
rm ./nmdc-log-service rm ./nmdc-log-service
echo "Building linux32..." echo "Building linux32..."
GOARCH=386 GOOS=linux go build -a -ldflags -s -o nmdc-log-service GOARCH=386 GOOS=linux go build -a -ldflags -s -o nmdc-log-service
sanitise nmdc-log-service
XZ_OPT=-9 tar caf nmdc-log-service-${version}-linux32.tar.xz nmdc-log-service --owner=0 --group=0 XZ_OPT=-9 tar caf nmdc-log-service-${version}-linux32.tar.xz nmdc-log-service --owner=0 --group=0
rm ./nmdc-log-service rm ./nmdc-log-service