scripts: unix line endings
This commit is contained in:
parent
d02cf6d979
commit
8cd4814beb
|
@ -1,47 +1,47 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# This script builds the application from source for only this platform.
|
# This script builds the application from source for only this platform.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Get the parent directory of where this script is.
|
# Get the parent directory of where this script is.
|
||||||
SOURCE="${BASH_SOURCE[0]}"
|
SOURCE="${BASH_SOURCE[0]}"
|
||||||
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
|
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
|
||||||
|
|
||||||
# Change into that directory
|
# Change into that directory
|
||||||
cd $DIR
|
cd $DIR
|
||||||
|
|
||||||
# Get the git commit
|
# Get the git commit
|
||||||
GIT_COMMIT=$(git rev-parse HEAD)
|
GIT_COMMIT=$(git rev-parse HEAD)
|
||||||
GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)
|
GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)
|
||||||
|
|
||||||
# If we're building on Windows, specify an extension
|
# If we're building on Windows, specify an extension
|
||||||
EXTENSION=""
|
EXTENSION=""
|
||||||
if [ "$(go env GOOS)" = "windows" ]; then
|
if [ "$(go env GOOS)" = "windows" ]; then
|
||||||
EXTENSION=".exe"
|
EXTENSION=".exe"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GOPATHSINGLE=${GOPATH%%:*}
|
GOPATHSINGLE=${GOPATH%%:*}
|
||||||
if [ "$(go env GOOS)" = "windows" ]; then
|
if [ "$(go env GOOS)" = "windows" ]; then
|
||||||
GOPATHSINGLE=${GOPATH%%;*}
|
GOPATHSINGLE=${GOPATH%%;*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
echo "--> Getting dependencies..."
|
echo "--> Getting dependencies..."
|
||||||
go get ./...
|
go get ./...
|
||||||
|
|
||||||
# Build!
|
# Build!
|
||||||
echo "--> Building..."
|
echo "--> Building..."
|
||||||
gox \
|
gox \
|
||||||
-os="$(go env GOOS)" \
|
-os="$(go env GOOS)" \
|
||||||
-arch="$(go env GOARCH)" \
|
-arch="$(go env GOARCH)" \
|
||||||
-ldflags "-X main.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
-ldflags "-X main.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
||||||
-output "bin/terraform-{{.Dir}}" \
|
-output "bin/terraform-{{.Dir}}" \
|
||||||
./...
|
./...
|
||||||
mv bin/terraform-terraform${EXTENSION} bin/terraform${EXTENSION}
|
mv bin/terraform-terraform${EXTENSION} bin/terraform${EXTENSION}
|
||||||
cp bin/terraform* ${GOPATHSINGLE}/bin
|
cp bin/terraform* ${GOPATHSINGLE}/bin
|
||||||
|
|
||||||
# Done!
|
# Done!
|
||||||
echo
|
echo
|
||||||
echo "--> Results:"
|
echo "--> Results:"
|
||||||
ls -hl bin/
|
ls -hl bin/
|
||||||
|
|
Loading…
Reference in New Issue