File: version.sh

package info (click to toggle)
libcorkipset 1.1.1+20150311-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 968 kB
  • sloc: ansic: 5,247; python: 449; sh: 82; makefile: 20
file content (33 lines) | stat: -rwxr-xr-x 1,189 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
# ----------------------------------------------------------------------
# Copyright © 2011-2013, RedJack, LLC.
# All rights reserved.
#
# Please see the LICENSE.txt file in this distribution for license
# details.
# ----------------------------------------------------------------------

# Calculates the current version number.  If possible, this is the
# output of “git describe”.  If “git describe” returns an error (most
# likely because we're in an unpacked copy of a release tarball, rather
# than in a git working copy), then we fall back on reading the contents
# of the RELEASE-VERSION file.
#
# This will automatically update the RELEASE-VERSION file, if necessary.
# Note that the RELEASE-VERSION file should *not* be checked into git;
# please add it to your top-level .gitignore file.

version=$(dpkg-parsechangelog --show-field Version)
if [ -n ${version} ]; then
    # If we got something from git-describe, write the version to the
    # output file.
    echo ${version} > RELEASE-VERSION
else
    version=$(cat RELEASE-VERSION)
    if [ -z ${version} ]; then
        echo "Cannot find the version number!" >&2
        exit 1
    fi
fi

echo ${version}