]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/unifdef/scripts/reversion.sh
OpenSSL: Vendor import of OpenSSL 3.0.13
[FreeBSD/FreeBSD.git] / contrib / unifdef / scripts / reversion.sh
1 #!/bin/sh
2
3 if [ ! -f version.sh ] && [ ! -d .git ]
4 then
5         echo Your copy of unifdef is incomplete 1>&2
6         exit 1
7 fi
8
9 [ -f version.sh ] && . ./version.sh
10
11 if [ -d .git ]
12 then
13         GV=$(git describe | sed 's|-g*|.|g;s|[.]|-|')
14         git update-index -q --refresh
15         if git diff-index --quiet HEAD
16         then
17                 GD="$(git show --pretty=format:%ai -s HEAD)"
18         else
19                 GD="$(date +'%Y-%m-%d %H:%M:%S %z')"
20                 GV=$GV.XX
21         fi
22         [ unifdef -nt unifdef.c ] &&
23         [ unifdef -nt unifdef.h ] &&
24                 GD="$D"
25         if [ "$GV $GD" != "$V $D" ]
26         then
27                 echo "version $V $D"   1>&2
28                 echo "     -> $GV $GD" 1>&2
29                 V="$GV"
30                 D="$GD"
31                 echo "V=\"$V\""  >version.sh
32                 echo "D=\"$D\"" >>version.sh
33                 rm -f version.h
34         fi
35 fi
36
37 if [ ! -f version.h ]
38 then
39         printf '"@(#) $Version: %s $\\n"\n' "$V" >version.h
40         printf '"@(#) $Date: %s $\\n"\n'   "$D" >>version.h
41 fi