-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect
RTL_AIRBAND_VERION
when building from a release archive (#456)
* add script to get version string either from git or parent dir name
- Loading branch information
1 parent
68e7783
commit e007afe
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
PROJECT_ROOT_PATH="$(cd $(dirname "$0")/../ ; pwd)" | ||
PROJECT_GIT_DIR_PATH="${PROJECT_ROOT_PATH}/.git" | ||
PROJECT_DIR_NAME="$(basename ${PROJECT_ROOT_PATH})" | ||
|
||
# if there is a .git directory at the project root then rely on git for the version string | ||
if [ -d "${PROJECT_GIT_DIR_PATH}" ] ; then | ||
git describe --tags --abbrev --dirty --always | ||
exit 0 | ||
fi | ||
|
||
# if the proejct root directory matches the naming convetion of an extracted archive then | ||
# get the version number out of that | ||
if [[ "${PROJECT_DIR_NAME}" =~ ^RTLSDR-Airband-[0-9]*\.[0-9]*\.[0-9]*$ ]]; then | ||
echo ${PROJECT_DIR_NAME} | cut -d '-' -f 3 | ||
exit 0 | ||
fi | ||
|
||
# print an error string to stderr (any output to stdout is considered success) | ||
>&2 echo "did not find a git root directory at ${PROJECT_GIT_DIR_PATH} and failed to extract a version from ${PROJECT_DIR_NAME}" |