File: get-version.sh

package info (click to toggle)
libhtp 0.5.15-1~bpo70%2B1
  • links: PTS
  • area: main
  • in suites: wheezy-backports
  • size: 4,308 kB
  • sloc: cpp: 23,652; sh: 11,187; ansic: 8,731; php: 170; makefile: 92
file content (32 lines) | stat: -rwxr-xr-x 487 bytes parent folder | download | duplicates (13)
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
#!/bin/sh

# Needed to remove the new line when echoing the version
nl='
'

VERSION=

usage="\
Usage: $0 version_file
Print a version string.
"

version_file="$1"
if test -z "$version_file"; then
  echo "$usage"
  exit 1
fi
if test -f $version_file; then
  . ./$version_file
else
  echo "Version file $version_file not found"
  exit 1
fi

if test -z $PKG_VERSION; then
  echo "No version found in $version_file"
  exit 1
fi

# Omit the trailing newline
echo "$PKG_VERSION" | tr -d "$nl"