2
0
Fork 0
mirror of https://github.com/AsahiLinux/m1n1 synced 2024-12-19 10:13:10 +00:00
m1n1/version.sh
Tobias Heider 8dd002d4f7 Replace bashisms with posix shell alternatives.
Signed-off-by: Tobias Heider <me@tobhe.de>
2023-01-13 17:29:15 +09:00

17 lines
413 B
Bash
Executable file

#!/bin/sh
cd "$(dirname "$0")"
dirbase="$(basename "$(pwd)")"
if [ -n "$M1N1_VERSION_TAG" ]; then
version="$M1N1_VERSION_TAG"
elif [ -e ".git" ]; then
version="$(git describe --tags --always --dirty)"
elif [ "$(echo "${dirbase}" | cut -c1-5)" = "m1n1-" ]; then
version=$(echo "${dirbase}" | cut -c6-)
version="v${version##v}"
else
version="unknown"
fi
echo "#define BUILD_TAG \"$version\""