File: setlibreswanversion

package info (click to toggle)
libreswan 5.2-2.3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 81,644 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (36 lines) | stat: -rwxr-xr-x 843 bytes parent folder | download | duplicates (2)
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}"