Files
systemd/tools/vcs-tag.sh
Daan De Meyer b2634bde3c meson: Use custom_target() instead of vcs_tag()
vsc_tag() always reruns even if the vcs-tag option is disabled. Let's
use custom_target() instead so that we can only enable build_always_stale
if the vcs-tag option is enabled.
2025-04-09 16:21:08 +02:00

24 lines
453 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
INPUT="$1"
MODE="$2"
ENABLED="$3"
if ! ((ENABLED)) || ! [[ -d .git ]] || ! command -v git >/dev/null || git describe --tags --exact-match &>/dev/null
then
sed "$INPUT" -e "s/@VCS_TAG@//"
exit 0
fi
if [[ "$MODE" == "developer" ]]; then
DIRTY="--dirty=^"
else
DIRTY=""
fi
TAG="-g$(git describe --abbrev=7 --match="" --always $DIRTY)"
sed "$INPUT" -e "s/@VCS_TAG@/$TAG/"