1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#!/bin/sh
#
# Copyright (C) 2012 Paul Wouters <paul@libreswan.org>
#
# Based on Openswan version
#
# Called via mk/config.mk
#
# Options: IPSECVERSION is passed as ${1}, basedir as ${2}
usage() {
echo "Usage: $0 <baseversion> [srctree]" >&2
echo " $0 --add-git-diry <baseversion> [srctree]" >&2
exit 1
}
ADD_GIT_DIRTY=
if [ "${1}" = "--add-git-diry" ]; then ADD_GIT_DIRTY=' --dirty'; shift; fi
baseversion="${1}"
[ -n "${baseversion}" ] || usage
cd "${2:-.}" || usage
# -f .git check is needed for "git worktree"
if false; then
if git version >/dev/null 2>&1; then
CUR=$(git describe --tags --always ${ADD_GIT_DIRTY})
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "${CUR}-${BRANCH}"
exit 0
else
echo "Error: git should be installed to determine exact Libreswan version" >&2
fi
fi
echo "${baseversion}"
|