mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
Include build user and host in long version
This commit is contained in:
parent
264bcbc78c
commit
c64549471a
7
build.sh
7
build.sh
@ -5,6 +5,9 @@ export COPYFILE_DISABLE=true
|
|||||||
distFiles=(README.md LICENSE) # apart from the binary itself
|
distFiles=(README.md LICENSE) # apart from the binary itself
|
||||||
version=$(git describe --always --dirty)
|
version=$(git describe --always --dirty)
|
||||||
date=$(date +%s)
|
date=$(date +%s)
|
||||||
|
user=$(whoami)
|
||||||
|
host=$(hostname -s)
|
||||||
|
ldflags="-w -X main.Version $version -X main.BuildStamp $date -X main.BuildUser $user -X main.BuildHost $host"
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
if command -v godep >/dev/null ; then
|
if command -v godep >/dev/null ; then
|
||||||
@ -15,8 +18,8 @@ build() {
|
|||||||
go get -d ./cmd/syncthing
|
go get -d ./cmd/syncthing
|
||||||
godep=
|
godep=
|
||||||
fi
|
fi
|
||||||
${godep} go build $* -ldflags "-w -X main.Version $version -X main.BuildStamp $date" ./cmd/syncthing
|
${godep} go build $* -ldflags "$ldflags" ./cmd/syncthing
|
||||||
${godep} go build -ldflags "-w -X main.Version $version -X main.BuildStamp $date" ./cmd/stcli
|
${godep} go build -ldflags "$ldflags" ./cmd/stcli
|
||||||
}
|
}
|
||||||
|
|
||||||
assets() {
|
assets() {
|
||||||
|
@ -32,6 +32,8 @@ var (
|
|||||||
Version = "unknown-dev"
|
Version = "unknown-dev"
|
||||||
BuildStamp = "0"
|
BuildStamp = "0"
|
||||||
BuildDate time.Time
|
BuildDate time.Time
|
||||||
|
BuildHost = "unknown"
|
||||||
|
BuildUser = "unknown"
|
||||||
LongVersion string
|
LongVersion string
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ func init() {
|
|||||||
BuildDate = time.Unix(int64(stamp), 0)
|
BuildDate = time.Unix(int64(stamp), 0)
|
||||||
|
|
||||||
date := BuildDate.UTC().Format(time.RFC3339)
|
date := BuildDate.UTC().Format(time.RFC3339)
|
||||||
LongVersion = fmt.Sprintf("syncthing %s (%s %s-%s) %s", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, date)
|
LongVersion = fmt.Sprintf("syncthing %s (%s %s-%s) %s@%s %s", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user