1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00
systemd/tools/vcs-tag.sh
Zbigniew Jędrzejewski-Szmek 40238aeee2 meson: avoid error message if git is not installed
[1/9] Generating version.h with a custom command
/home/zbyszek/src/systemd/tools/vcs-tag.sh: line 17: git: command not found

If git is not available, do not try to call it.
2024-12-05 12:49:50 +00:00

21 lines
356 B
Bash
Executable File

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