From: Matthew Newton Date: Tue, 10 Oct 2023 13:39:24 +0000 (+0100) Subject: update version.sh to cope with a prerelease X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9ce9c4433de8458a460f7c55354f3a91a197efc;p=thirdparty%2Ffreeradius-server.git update version.sh to cope with a prerelease --- diff --git a/version.sh b/version.sh index 6cddbe16c6..44aabfba0f 100755 --- a/version.sh +++ b/version.sh @@ -28,6 +28,7 @@ release_file=RELEASE version_major=4 version_minor=0 version_incrm= +version_prerelease= commit= commit_depth= is_release=0 @@ -51,6 +52,8 @@ usage() echo "component may be one of:" echo "major Major version component from ${version_file}." echo "minor Minor version component from ${version_file}." + echo "incrm Incremental version component from ${version_file}." + echo "prerelease Pre-release version component from ${version_file}." echo "commit Short (8 hexit) commit hash." echo "commit_depth How many commit since the last tag." echo "is_release true if the current commit has been tagged as a release, else false." @@ -67,20 +70,25 @@ version_component() for c in "$@"; do case "$c" in major) - out=$(cut -f1 -d. 2>/dev/null < ${version_file}) + out=$(cut -f1 -d~ 2>/dev/null < ${version_file} | cut -f1 -d.) if [ -z "${out}" ]; then out="${version_major}"; fi ;; minor) - out=$(cut -f2 -d. 2>/dev/null < ${version_file}) + out=$(cut -f1 -d~ 2>/dev/null < ${version_file} | cut -f2 -d.) if [ -z "${out}" ]; then out="${version_minor}"; fi ;; incrm) - out=$(cut -f3 -d. 2>/dev/null < ${version_file}) + out=$(cut -f1 -d~ 2>/dev/null < ${version_file} | cut -f3 -d.) if [ -z "${out}" ]; then out="${version_incrm}"; fi ;; + prerelease) + out=$(cut -s -f2 -d~ 2>/dev/null < ${version_file}) + if [ -z "${out}" ]; then out="$version_prerelease"; fi + ;; + commit) out=$(\ cat ${commit_file} 2> /dev/null || \