github.com/fozzysec/SiaPrime@v0.0.0-20190612043147-66c8e8d11fe3/deploy.sh (about) 1 #!/bin/bash 2 3 PRIVKEY=$1 4 5 # Create fresh artifacts folder. 6 rm -rf artifacts 7 mkdir artifacts 8 9 # Return first error encountered by any command. 10 set -e 11 12 # Generate public key from private key. 13 echo "$PRIVKEY" | openssl rsa -in - -outform PEM -pubout -out artifacts/pubkey.pem 14 15 # Build binaries and sign them. 16 for arch in amd64 arm; do 17 for os in darwin linux windows; do 18 for pkg in spc spd; do 19 # Ignore unsupported arch/os combinations. 20 if [ "$arch" == "arm" ]; then 21 if [ "$os" == "windows" ] || [ "$os" == "darwin" ]; then 22 continue 23 fi 24 fi 25 26 # Binaries are called 'spc' and i'spd'. 27 bin=$pkg 28 29 # Different naming convention for windows. 30 if [ "$os" == "windows" ]; then 31 bin=${pkg}.exe 32 fi 33 34 # Build binary. 35 GOOS=${os} GOARCH=${arch} go build -tags='netgo' -o artifacts/$arch/$os/$bin ./cmd/$pkg 36 37 # Sign binary. 38 echo "$PRIVKEY" | openssl dgst -sha256 -sign - -out artifacts/$arch/$os/$bin.sha256 artifacts/$arch/$os/$bin 39 done 40 done 41 done