Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions ada/ada
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,21 @@ set_defaults() {
}
# End set_defaults()

get_version() {
# Returns the version of the script
_VERSION="v3.0+"
git_dir=$(dirname "${script_dir}")

if [[ -d "${git_dir}/.git" ]]; then
# Use git describe to get version
_VERSION=$(git --git-dir="${git_dir}/.git" describe --tags --abbrev=0 2>/dev/null || echo "v3.0+")
elif [[ -d "/etc/ada-release" ]]; then
# Use /etc/ada-release to get script version (created by Ansible or so)
_VERSION=$(cat /etc/ada-release)
fi

echo "${_VERSION}"
}
#
# Process command line arguments
#
Expand All @@ -390,9 +405,7 @@ get_args() {
usage
;;
--version )
git_dir=$(dirname "${script_dir}")
_VERSION_PLACEHOLDER=$(git --git-dir="${git_dir}/.git" describe --tags --abbrev=0 2>/dev/null || echo "v3.0+")
echo "${_VERSION_PLACEHOLDER}"
get_version
exit 1
;;
--tokenfile )
Expand Down