File: parse_version.sh

package info (click to toggle)
dlt-viewer 2.28.1-dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,524 kB
  • sloc: cpp: 31,907; ansic: 4,231; xml: 492; sh: 244; makefile: 81
file content (19 lines) | stat: -rwxr-xr-x 516 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
#!/usr/bin/env bash
set -eu

_print_usage() {
    echo "Parse DLT Viewer version.h and return version number depending on requested part."
    echo "Usage: parse_version.sh <path to version.h> <PACKAGE_MAJOR_VERSION | PACKAGE_MINOR_VERSION | PACKAGE_PATCH_LEVEL>"
}

if [[ $# -ne 2 ]]; then
    _print_usage
    exit 1
fi

if [ "${2}" != "PACKAGE_MAJOR_VERSION" -a "${2}" != "PACKAGE_MINOR_VERSION" -a "${2}" != "PACKAGE_PATCH_LEVEL" ]; then
    _print_usage
    exit 1
fi

echo $(grep ${2} ${1} | awk '{print $3}')