Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / ntp / dist / scripts / genver
blobddf25cd415365bc5c1a7a1fb9ccc0c6dda628111
1 #! /bin/sh
3 # possible usage: $0 [-f] [version.m4] [version.def]
5 # -f would be 'force the update'
7 force=0
8 outputs=
9 for i in $*
11 case "$i" in
12 -f) force=1 ;;
13 version.m4)
14 outputs="version.m4 $outputs"
16 *version.def)
17 outputs="include/version.def $outputs"
19 *version.texi)
20 outputs="include/version.texi $outputs"
22 *) echo "Unrecognized option: $i"
23 exit 1
25 esac
26 done
28 case "$outputs" in
29 '') outputs="version.m4 include/version.def include/version.texi" ;;
30 esac
32 set -e
34 . ./packageinfo.sh
36 dversion=`scripts/VersionName`
38 set +e
40 case "$outputs" in
41 *version.m4*)
42 echo "m4_define([VERSION_NUMBER],[${dversion}])" > /tmp/version.m4+
43 cmp -s /tmp/version.m4+ version.m4
44 rc=$?
45 case "$force$rc" in
46 00)
47 rm -f /tmp/version.m4+
50 mv /tmp/version.m4+ version.m4
52 esac
54 esac
56 case "$outputs" in
57 *version.def*)
58 echo "version = '${dversion}';" > /tmp/version.def+
59 cmp -s /tmp/version.def+ include/version.def
60 rc=$?
61 case "$force$rc" in
62 00)
63 rm -f /tmp/version.def+
66 mv /tmp/version.def+ include/version.def
68 esac
70 esac
72 case "$outputs" in
73 *version.texi*)
74 echo "@set UPDATED `date +'%d %B %Y'`" > /tmp/version.texi+
75 echo "@set EDITION $dversion" >> /tmp/version.texi+
76 echo "@set VERSION $dversion" >> /tmp/version.texi+
77 cmp -s /tmp/version.texi+ include/version.texi
78 rc=$?
79 case "$force$rc" in
80 00)
81 rm -f /tmp/version.texi+
84 mv /tmp/version.texi+ include/version.texi
86 esac
88 esac