summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-06-13 20:44:00 +0200
committerJakob Borg <jakob@nym.se>2014-06-13 20:44:00 +0200
commit58c5e46206485aaed1774c8db7773dfffd98ced7 (patch)
treef2905652520dc8b382b40acb9db0cf6387903d05
parent4c61ab0f1831113f34d5e1bab040c18c86471995 (diff)
Add build environment variable
-rwxr-xr-xbuild.sh3
-rw-r--r--cmd/syncthing/main.go3
2 files changed, 4 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index 0d06aefb68..9d7ca8579b 100755
--- a/build.sh
+++ b/build.sh
@@ -9,7 +9,8 @@ date=$(git show -s --format=%ct)
user=$(whoami)
host=$(hostname)
host=${host%%.*}
-ldflags="-w -X main.Version $version -X main.BuildStamp $date -X main.BuildUser $user -X main.BuildHost $host"
+bldenv=${ENVIRONMENT:-default}
+ldflags="-w -X main.Version $version -X main.BuildStamp $date -X main.BuildUser $user -X main.BuildHost $host -X main.BuildEnv $bldenv"
check() {
if ! command -v godep >/dev/null ; then
diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go
index 5a2c58a801..485bb08be0 100644
--- a/cmd/syncthing/main.go
+++ b/cmd/syncthing/main.go
@@ -36,6 +36,7 @@ import (
var (
Version = "unknown-dev"
+ BuildEnv = "default"
BuildStamp = "0"
BuildDate time.Time
BuildHost = "unknown"
@@ -50,7 +51,7 @@ func init() {
BuildDate = time.Unix(int64(stamp), 0)
date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST")
- LongVersion = fmt.Sprintf("syncthing %s (%s %s-%s) %s@%s %s", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date)
+ LongVersion = fmt.Sprintf("syncthing %s (%s %s-%s %s) %s@%s %s", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildEnv, BuildUser, BuildHost, date)
if os.Getenv("STTRACE") != "" {
logFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile