xref: /freebsd/contrib/ntp/scripts/build/VersionName (revision 416ba5c74546f32a993436a99516d35008e9f384)
1*2b15cb3dSCy Schubert#! /bin/sh
2*2b15cb3dSCy Schubert
3*2b15cb3dSCy Schubertpackageinfo='./packageinfo.sh'
4*2b15cb3dSCy Schubertcase "$#" in
5*2b15cb3dSCy Schubert 2)
6*2b15cb3dSCy Schubert    case "$1" in
7*2b15cb3dSCy Schubert     -p|--packageinfo)
8*2b15cb3dSCy Schubert	packageinfo="$2"
9*2b15cb3dSCy Schubert    esac
10*2b15cb3dSCy Schubert    ;;
11*2b15cb3dSCy Schubert 0)
12*2b15cb3dSCy Schubert    ;;
13*2b15cb3dSCy Schubert *) echo "Usage: $0 [-p packageinfo.sh]"
14*2b15cb3dSCy Schubert    exit 1
15*2b15cb3dSCy Schubert    ;;
16*2b15cb3dSCy Schubertesac
17*2b15cb3dSCy Schubert
18*2b15cb3dSCy Schubert# This script must be executed from the TLD of the source tree...
19*2b15cb3dSCy Schubert. "$packageinfo"
20*2b15cb3dSCy Schubert
21*2b15cb3dSCy SchubertNAME="$version"
22*2b15cb3dSCy Schubertcase "$repotype::$point" in
23*2b15cb3dSCy Schubert dev::)
24*2b15cb3dSCy Schubert    case "${proto}.${major}" in
25*2b15cb3dSCy Schubert     4.[012])
26*2b15cb3dSCy Schubert	NAME="${NAME}p${point}"
27*2b15cb3dSCy Schubert        ;;
28*2b15cb3dSCy Schubert     *) NAME="${NAME}"
29*2b15cb3dSCy Schubert        ;;
30*2b15cb3dSCy Schubert    esac
31*2b15cb3dSCy Schubert    ;;
32*2b15cb3dSCy Schubert stable::[1-9]* | dev::[0-9]*)
33*2b15cb3dSCy Schubert    case "${proto}.${major}" in
34*2b15cb3dSCy Schubert     4.[012])
35*2b15cb3dSCy Schubert	NAME="${NAME}p${point}"
36*2b15cb3dSCy Schubert        ;;
37*2b15cb3dSCy Schubert     *) NAME="${NAME}.${point}"
38*2b15cb3dSCy Schubert        ;;
39*2b15cb3dSCy Schubert    esac
40*2b15cb3dSCy Schubert    ;;
41*2b15cb3dSCy Schubert NEW) ;;
42*2b15cb3dSCy Schubert '') ;;
43*2b15cb3dSCy Schubert *) echo "Unexpected value for 'point' <$point>! (repotype is <$repotype>)"
44*2b15cb3dSCy Schubert    exit 1
45*2b15cb3dSCy Schubert    ;;
46*2b15cb3dSCy Schubertesac
47*2b15cb3dSCy Schubert
48*2b15cb3dSCy Schubertcase $special in
49*2b15cb3dSCy Schubert '') ;;
50*2b15cb3dSCy Schubert *) NAME="${NAME}-${special}" ;;
51*2b15cb3dSCy Schubertesac
52*2b15cb3dSCy Schubert
53*2b15cb3dSCy Schubertcase "$prerelease::$repotype" in
54*2b15cb3dSCy Schubert ''::*)
55*2b15cb3dSCy Schubert    ;;
56*2b15cb3dSCy Schubert beta::stable)
57*2b15cb3dSCy Schubert    NAME="${NAME}-beta${betapoint}"
58*2b15cb3dSCy Schubert    ;;
59*2b15cb3dSCy Schubert rc::dev|RC::dev)
60*2b15cb3dSCy Schubert    NAME="${NAME}-RC"
61*2b15cb3dSCy Schubert    ;;
62*2b15cb3dSCy Schubert rc::stable|RC::stable)
63*2b15cb3dSCy Schubert    NAME="${NAME}-RC${rcpoint}"
64*2b15cb3dSCy Schubert    ;;
65*2b15cb3dSCy Schubert *) echo "Unexpected value for 'prerelease::repotype' <$prerelease::$repotype>!"
66*2b15cb3dSCy Schubert    exit 1
67*2b15cb3dSCy Schubert    ;;
68*2b15cb3dSCy Schubertesac
69*2b15cb3dSCy Schubert
70*2b15cb3dSCy Schubertecho "$NAME"
71