release 1.7.0: --ver/--version/-V prints version, commit, repo
This commit is contained in:
parent
8d6aabaab6
commit
4a4a9cd0ad
4 changed files with 71 additions and 7 deletions
|
|
@ -12,6 +12,66 @@
|
|||
set -euo pipefail
|
||||
ROOT=$(cd "$(dirname "$0")" && pwd)
|
||||
|
||||
# --- suite identity (also: --ver / --version / -V) ---
|
||||
SOURCE_REPO_WEB="${SOURCE_REPO_WEB:-https://git.hacktivism.ch/hernani/taler-monitoring}"
|
||||
SOURCE_REPO_GIT="${SOURCE_REPO_GIT:-https://git.hacktivism.ch/hernani/taler-monitoring.git}"
|
||||
|
||||
print_version() {
|
||||
local ver tag commit commit_full dirty branch
|
||||
ver="unknown"
|
||||
if [ -f "$ROOT/VERSION" ]; then
|
||||
ver=$(tr -d "[:space:]" <"$ROOT/VERSION" | sed "s/^v//")
|
||||
fi
|
||||
tag=""
|
||||
commit="unknown"
|
||||
commit_full=""
|
||||
branch=""
|
||||
dirty=""
|
||||
if git -C "$ROOT" rev-parse --git-dir >/dev/null 2>&1; then
|
||||
tag=$(git -C "$ROOT" describe --tags --exact-match 2>/dev/null || true)
|
||||
if [ -z "$tag" ]; then
|
||||
tag=$(git -C "$ROOT" describe --tags --abbrev=0 2>/dev/null || true)
|
||||
fi
|
||||
commit=$(git -C "$ROOT" rev-parse --short=12 HEAD 2>/dev/null || echo unknown)
|
||||
commit_full=$(git -C "$ROOT" rev-parse HEAD 2>/dev/null || true)
|
||||
branch=$(git -C "$ROOT" rev-parse --abbrev-ref HEAD 2>/dev/null || true)
|
||||
if [ -n "$(git -C "$ROOT" status --porcelain 2>/dev/null)" ]; then
|
||||
dirty=" (dirty)"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$tag" ] && [ "$tag" = "v$ver" ]; then
|
||||
printf "taler-monitoring %s\n" "$tag"
|
||||
else
|
||||
printf "taler-monitoring v%s\n" "$ver"
|
||||
fi
|
||||
printf "version: %s\n" "$ver"
|
||||
if [ -n "$tag" ]; then
|
||||
if [ "$tag" = "v$ver" ]; then
|
||||
printf "tag: %s\n" "$tag"
|
||||
else
|
||||
printf "git-tag: %s (tree; VERSION file is %s)\n" "$tag" "$ver"
|
||||
fi
|
||||
fi
|
||||
printf "commit: %s%s\n" "$commit" "$dirty"
|
||||
[ -n "$branch" ] && [ "$branch" != "HEAD" ] && printf "branch: %s\n" "$branch"
|
||||
printf "repo: %s\n" "$SOURCE_REPO_WEB"
|
||||
printf "clone: %s\n" "$SOURCE_REPO_GIT"
|
||||
if [ -n "$commit_full" ]; then
|
||||
printf "commit-url: %s/src/commit/%s\n" "$SOURCE_REPO_WEB" "$commit_full"
|
||||
fi
|
||||
if [ -n "$tag" ]; then
|
||||
printf "tag-url: %s/src/tag/%s\n" "$SOURCE_REPO_WEB" "$tag"
|
||||
fi
|
||||
}
|
||||
|
||||
# Fast path: version before loading lib.sh / phases
|
||||
case "${1:-}" in
|
||||
--ver|--version|-V)
|
||||
print_version
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Line-buffered stdout/stderr so redirected logs (tee/host-agent) flush each line.
|
||||
if [ "${_TALER_MON_STDBUF:-0}" != "1" ] && command -v stdbuf >/dev/null 2>&1; then
|
||||
export _TALER_MON_STDBUF=1
|
||||
|
|
@ -61,6 +121,7 @@ Options:
|
|||
--no-probe do not probe alternate hosts (unknown domains only)
|
||||
--lang en|fr UI/console language (sticky bar + badges)
|
||||
overrides auto (FrancPaysan→fr, else en)
|
||||
--ver, --version, -V print suite version, git commit, and repo URLs
|
||||
-h, --help
|
||||
|
||||
Add a stack: edit domains.conf (name + bank + exchange + merchant + currency).
|
||||
|
|
@ -159,6 +220,7 @@ while [ $# -gt 0 ]; do
|
|||
i18n_init 2>/dev/null || true
|
||||
;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
--ver|--version|-V) print_version; exit 0 ;;
|
||||
-d|--domain)
|
||||
[ $# -ge 2 ] || { echo "missing arg for $1" >&2; exit 2; }
|
||||
apply_taler_domain "$2"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue