Files
virtual-kubelet/vendor/github.com/hyperhq/hypercli/build.sh
2017-12-05 17:53:58 -06:00

43 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
VERSION=$(< ./VERSION)
if command -v git &> /dev/null && git rev-parse &> /dev/null; then
GITCOMMIT=$(git rev-parse --short HEAD)
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
GITCOMMIT="$GITCOMMIT"
fi
BUILDTIME=$(date -u)
elif [ "$HYPER_GITCOMMIT" ]; then
GITCOMMIT="$HYPER_GITCOMMIT"
else
echo >&2 'error: .git directory missing and HYPER_GITCOMMIT not specified'
echo >&2 ' Please either build with the .git directory accessible, or specify the'
echo >&2 ' exact (--short) commit hash you are building using HYPER_GITCOMMIT for'
echo >&2 ' future accountability in diagnosing build issues. Thanks!'
exit 1
fi
cat > dockerversion/version_autogen.go <<DVEOF
// +build autogen
// Package dockerversion is auto-generated at build-time
package dockerversion
// Default build-time variable for library-import.
// This file is overridden on build with build-time informations.
const (
GitCommit string = "$GITCOMMIT"
Version string = "$VERSION"
BuildTime string = "$BUILDTIME"
IAmStatic string = "${IAMSTATIC:-true}"
)
// AUTOGENERATED FILE; see $BASH_SOURCE
DVEOF
CLI_ROOT=$(dirname "{BASH_SOURCE}")
export DOCKER_CLIENTONLY=yes
cd ${CLI_ROOT}
export GOPATH=$(pwd)/vendor:$GOPATH
cd $(pwd)/hyper
go build -ldflags "-s -w" -tags autogen .