forked from hyperhq/hypercli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·42 lines (37 loc) · 1.26 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·42 lines (37 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/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 .