From d6c44bde782fb5873f47441aa5e52255bfc2006e Mon Sep 17 00:00:00 2001
From: nrb <freifunk@nicoboehr.de>
Date: Mon, 14 Oct 2019 20:29:21 +0200
Subject: [PATCH] allow to specify gluon major

---
 .gitlab-ci.yml  | 2 +-
 update-gluon.sh | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5c4983a..5a45da1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,5 +17,5 @@ build:
     - mkdir -p ~/.ssh
     - cat gitlab-known-hosts >> ~/.ssh/known_hosts
   script:
-    - ./update-gluon.sh
+    - ./update-gluon.sh "$GLUON_MAJOR_VERSION"
   cache: {}
diff --git a/update-gluon.sh b/update-gluon.sh
index b691c8e..a46183e 100755
--- a/update-gluon.sh
+++ b/update-gluon.sh
@@ -4,11 +4,17 @@ set -x
 set -eu
 set -o pipefail
 
+gluon_major_version="${1:-}"
+if [ -z "$gluon_major_version" ]; then
+	echo "usage: $0 <gluon major version>" >&2
+	exit 1
+fi
 gluon_fork_git_url="ssh://git@gitlab.freifunk-stuttgart.de:22220/nrb/gluon-test.git"
 gluon_upstream_git_url="https://github.com/freifunk-gluon/gluon.git"
 site_git_url="ssh://git@gitlab.freifunk-stuttgart.de:22220/nrbffs/site-ffs.git"
 
-upstream_newest_minor=$(git ls-remote --tags --refs "$gluon_upstream_git_url" 'refs/tags/v2018.2*' | cut -d/ -f3 | sort -r -n -t. -k2 | head -n1)
+upstream_newest_minor=$(git ls-remote --tags --refs "$gluon_upstream_git_url" "refs/tags/$gluon_major_version"* | cut -d/ -f3 | sort -r -n -t. -k2 | head -n1)
+
 # branch name in our forked gluon
 fork_newest_minor_branch="$upstream_newest_minor-ffs"
 fork_newest_minor_tag="$upstream_newest_minor-ffs0.1"
-- 
GitLab