Skip to content

Commit 1d4e263

Browse files
committed
Use new helper script version.sh to always get the version components right, no risk of undefined version components in VERSION files.
1 parent 4c9409b commit 1d4e263

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ NXLIBDIR ?= $(PREFIX)/lib/nx
1919
X2GOLIBDIR ?= $(PREFIX)/lib/x2go
2020
CONFIGURE ?= ./configure
2121

22-
NX_VERSION_MAJOR=$(shell cat VERSION | cut -d"." -f1)
23-
NX_VERSION_MINOR=$(shell cat VERSION | cut -d"." -f2)
24-
NX_VERSION_MICRO=$(shell cat VERSION | cut -d"." -f3)
25-
NX_VERSION_PATCH=$(shell cat VERSION | cut -d"." -f4)
22+
NX_VERSION_MAJOR=$(shell ./version.sh 1)
23+
NX_VERSION_MINOR=$(shell ./version.sh 2)
24+
NX_VERSION_MICRO=$(shell ./version.sh 3)
25+
NX_VERSION_PATCH=$(shell ./version.sh 4)
2626

2727
SHELL:=/bin/bash
2828

version.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
# Copyright (C) 2015 Mihai Moldovan <ionic@ionic.de>
4+
# Copyright (C) 2015 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
5+
#
6+
# This program is free software; you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation; either version 2 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program; if not, write to the
18+
# Free Software Foundation, Inc.,
19+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20+
21+
COMPONENT="$1"
22+
VERSION_FILE="VERSION"
23+
24+
[ -z "$COMPONENT" ] && { echo "usage: $(basename $0) <position-in-version-number>"; exit 1; }
25+
26+
# More than one line is not supported.
27+
VER="$(head -n "1" "${VERSION_FILE}" | cut -d"." -f"${COMPONENT}")"
28+
29+
[ "x${VER}" = "x" ] && VER="0"
30+
31+
printf "${VER}"

0 commit comments

Comments
 (0)