From 27803ec1a4c2d9dba84865a8b538ac8385ee189b Mon Sep 17 00:00:00 2001
From: Ruben Pollan <meskio@sindominio.net>
Date: Mon, 9 Jul 2018 17:06:19 +0200
Subject: [PATCH] [pkg] use the version string from the systray

---
 Makefile        | 8 ++++----
 osx/Makefile    | 2 +-
 osx/generate.py | 2 +-
 version         | 1 -
 4 files changed, 6 insertions(+), 7 deletions(-)
 delete mode 100644 version

diff --git a/Makefile b/Makefile
index 1822453..b69f1b3 100755
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
-SYSTRAY := 0xacab.org/leap/bitmask-systray.git
+SYSTRAY := 0xacab.org/leap/bitmask-systray
 STAGING := staging
 SYSTRAY_BIN := bitmask-systray
 HELPER_BIN := bitmask_helper
 APP_NAME := RiseupVPN
 BUILD_RELEASE?=no
 OSX_CERT = "Developer ID Installer: LEAP Encryption Access Project"
-VERSION = $(shell cat version)
+VERSION = $(shell git -C `go env GOPATH`/src/$(SYSTRAY)  describe --tags)
 
 # -----------------------------------------------------------------------------
 # Windows 
@@ -51,11 +51,11 @@ helper_osx:
 	upx $(STAGING)/$(HELPER_BIN)
 systray_osx:
 	go get -tags "standalone" -u $(SYSTRAY)
-	go build -tags "standalone" -o $(STAGING)/$(SYSTRAY_BIN) $(SYSTRAY)
+	go build -tags "standalone" -ldflags "-X main.version=$(VERSION)" -o $(STAGING)/$(SYSTRAY_BIN) $(SYSTRAY)
 	upx $(STAGING)/$(SYSTRAY_BIN)
 bundle_osx:
 	mkdir -p dist
-	make -C osx
+	make -C osx VERSION=$(VERSION)
 pkg_osx:
 	osx/quickpkg --output dist/$(APP_NAME)-$(VERSION)_unsigned.pkg --scripts osx/scripts/ dist/$(APP_NAME).app/
 	@if [ $(BUILD_RELEASE) = no ]; then\
diff --git a/osx/Makefile b/osx/Makefile
index 9742135..de54385 100644
--- a/osx/Makefile
+++ b/osx/Makefile
@@ -1,2 +1,2 @@
 generate:
-	python ./generate.py
+	python ./generate.py $(VERSION)
diff --git a/osx/generate.py b/osx/generate.py
index b9248cb..6d73e28 100644
--- a/osx/generate.py
+++ b/osx/generate.py
@@ -30,7 +30,7 @@ TEMPLATE_HELPER = 'template-helper.plist'
 TEMPLATE_PREINSTALL = 'template-preinstall'
 TEMPLATE_POSTINSTALL = 'template-postinstall'
 
-VERSION = open(os.path.join(here, '..', 'version')).read().strip()
+VERSION = sys.argv[1]
 
 APP_PATH = os.path.abspath(here + '/../dist/' + APP_NAME + ".app")
 STAGING = os.path.abspath(here + '/../staging/')
diff --git a/version b/version
deleted file mode 100644
index 51176c7..0000000
--- a/version
+++ /dev/null
@@ -1 +0,0 @@
-0.11
-- 
GitLab