package/mender: set version in go linker
authorMirza Krak <mirza.krak@northern.tech>
Mon, 20 Aug 2018 13:09:11 +0000 (15:09 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Mon, 20 Aug 2018 15:14:09 +0000 (17:14 +0200)
This is used when calling the mender client with the
-version option and it says "unknown" if not set in
linker.

Now it displays the following:

    # mender -version
    1.4.0
    runtime: go1.10.2

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/mender/mender.mk

index 53c39c6f7a67d1a4320295a66ea7acfb773436e6..9275426a7be3596550e69c7c9e545238c6eeafa4 100644 (file)
@@ -32,6 +32,8 @@ MENDER_LICENSE_FILES = \
        vendor/github.com/ungerik/go-sysfs/LICENSE \
        vendor/github.com/bmatsuo/lmdb-go/LICENSE.mdb.md
 
+MENDER_LDFLAGS = -X main.Version=$(MENDER_VERSION)
+
 define MENDER_INSTALL_CONFIG_FILES
        $(INSTALL) -d -m 755 $(TARGET_DIR)/etc/mender/scripts
        echo -n "2" > $(TARGET_DIR)/etc/mender/scripts/version