PageRenderTime 18ms CodeModel.GetById 7ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/ntp/scripts/genver

https://bitbucket.org/freebsd/freebsd-head/
Shell | 67 lines | 54 code | 9 blank | 4 comment | 1 complexity | 845c62149277f66103adf12d0dd0dae3 MD5 | raw file
 1#! /bin/sh
 2
 3# possible usage: $0 [-f] [version.m4] [version.def]
 4#
 5# -f would be 'force the update'
 6
 7force=0
 8outputs=
 9for i in $*
10do
11    case "$i" in
12     -f) force=1 ;;
13     version.m4)
14	outputs="version.m4 $outputs"
15	;;
16     *version.def)
17	outputs="include/version.def $outputs"
18	;;
19     *) echo "Unrecognized option: $i"
20	exit 1
21	;;
22    esac
23done
24
25case "$outputs" in
26 '') outputs="version.m4 include/version.def" ;;
27esac
28
29set -e
30
31. ./packageinfo.sh
32
33dversion=`scripts/VersionName`
34
35set +e
36
37case "$outputs" in
38 *version.m4*)
39    echo "m4_define([VERSION_NUMBER],[${dversion}])" > /tmp/version.m4+
40    cmp -s /tmp/version.m4+ version.m4
41    rc=$?
42    case "$force$rc" in
43     00)
44	rm -f /tmp/version.m4+
45	;;
46     *)
47	mv /tmp/version.m4+ version.m4
48	;;
49    esac
50    ;;
51esac
52
53case "$outputs" in
54 *version.def*)
55    echo "version = '${dversion}';" > /tmp/version.def+
56    cmp -s /tmp/version.def+ include/version.def
57    rc=$?
58    case "$force$rc" in
59     00)
60	rm -f /tmp/version.def+
61	;;
62     *)
63	mv /tmp/version.def+ include/version.def
64	;;
65    esac
66    ;;
67esac