summaryrefslogtreecommitdiffstats
path: root/get-version.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:40:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:40:56 +0000
commitc248d29056abbc1fc4c5dc178bab48fb8d2c1fcb (patch)
tree4a13fc30604509224504e1911bc976e5df7bdf05 /get-version.sh
parentInitial commit. (diff)
downloadlibhtp-c248d29056abbc1fc4c5dc178bab48fb8d2c1fcb.tar.xz
libhtp-c248d29056abbc1fc4c5dc178bab48fb8d2c1fcb.zip
Adding upstream version 1:0.5.47.upstream/1%0.5.47
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'get-version.sh')
-rwxr-xr-xget-version.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/get-version.sh b/get-version.sh
new file mode 100755
index 0000000..f962146
--- /dev/null
+++ b/get-version.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Needed to remove the new line when echoing the version
+nl='
+'
+
+VERSION=
+
+usage="\
+Usage: $0 version_file
+Print a version string.
+"
+
+version_file="$1"
+if test -z "$version_file"; then
+ echo "$usage"
+ exit 1
+fi
+if test -f $version_file; then
+ . ./$version_file
+else
+ echo "Version file $version_file not found"
+ exit 1
+fi
+
+if test -z $PKG_VERSION; then
+ echo "No version found in $version_file"
+ exit 1
+fi
+
+# Omit the trailing newline
+echo "$PKG_VERSION" | tr -d "$nl"