Added git installed check

This commit is contained in:
Alejandro Criado-Pérez 2023-08-19 13:41:30 +02:00
parent 30dc01eb97
commit 8a1a30befa
No known key found for this signature in database
GPG Key ID: 766DF93C61C31C03

View File

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "Error: git is not installed. Please install git and try again."
exit 1
fi
ROOTDIR="$(dirname "$0")/.." ROOTDIR="$(dirname "$0")/.."
BUILDDIR="${ROOTDIR}/build" BUILDDIR="${ROOTDIR}/build"
@ -10,6 +16,7 @@ else
BUILD_TYPE="$1" BUILD_TYPE="$1"
fi fi
# Check the first git tag that points to the current commit and starts with "v"
if [[ "$(git tag --points-at HEAD 2>/dev/null | head -n 1)" == v* ]]; then if [[ "$(git tag --points-at HEAD 2>/dev/null | head -n 1)" == v* ]]; then
touch "${ROOTDIR}/prerelease.txt" touch "${ROOTDIR}/prerelease.txt"
fi fi