2025-07-14 13:01:41 +02:00
|
|
|
#!/usr/bin/env bash
|
2024-07-19 13:05:11 +02:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
set -e
|
|
|
|
|
|
2025-04-09 13:54:22 +02:00
|
|
|
INPUT="$1"
|
|
|
|
|
MODE="$2"
|
|
|
|
|
ENABLED="$3"
|
2024-07-19 13:05:11 +02:00
|
|
|
|
2025-04-09 13:54:22 +02:00
|
|
|
if ! ((ENABLED)) || ! [[ -d .git ]] || ! command -v git >/dev/null || git describe --tags --exact-match &>/dev/null
|
2024-12-05 12:39:04 +01:00
|
|
|
then
|
2025-04-09 13:54:22 +02:00
|
|
|
sed "$INPUT" -e "s/@VCS_TAG@//"
|
2024-07-19 13:05:11 +02:00
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ "$MODE" == "developer" ]]; then
|
|
|
|
|
DIRTY="--dirty=^"
|
|
|
|
|
else
|
|
|
|
|
DIRTY=""
|
|
|
|
|
fi
|
|
|
|
|
|
2025-04-09 13:54:22 +02:00
|
|
|
TAG="-g$(git describe --abbrev=7 --match="" --always $DIRTY)"
|
|
|
|
|
|
|
|
|
|
sed "$INPUT" -e "s/@VCS_TAG@/$TAG/"
|