mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-22 16:41:22 +03:00
30 lines
523 B
Bash
Executable File
30 lines
523 B
Bash
Executable File
#! /bin/sh
|
|
|
|
LC_ALL=C
|
|
export LC_ALL
|
|
|
|
srcdir="$(dirname "$0")"
|
|
test -z "$srcdir" && srcdir=.
|
|
|
|
cd "$srcdir"
|
|
|
|
if [ -f version ]; then
|
|
printf '%s' "$(cat version)"
|
|
exit 0
|
|
fi
|
|
|
|
if ! [ -d .git ] || ! git log -n1 --pretty='%h' >/dev/null 2>&1; then
|
|
printf 'UNVERSIONED'
|
|
exit 0
|
|
fi
|
|
|
|
tmpfile="$(mktemp)"
|
|
|
|
if ! git describe --exact-match --tags $(git log -n1 --pretty='%h') >"$tmpfile" 2>/dev/null; then
|
|
echo g$(git log -n1 --pretty='%h') >"$tmpfile"
|
|
fi
|
|
|
|
printf '%s' "$(sed 's/^v//g' <"$tmpfile")"
|
|
|
|
rm -f "$tmpfile"
|