File: version.sh

package info (click to toggle)
nmh 1.8-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 7,860 kB
  • sloc: ansic: 50,445; sh: 22,697; makefile: 1,138; lex: 740; perl: 509; yacc: 265
file content (24 lines) | stat: -rwxr-xr-x 576 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
20
21
22
23
24
#! /bin/sh
#
# version.sh -- script to create version string(s) for nmh.
# You need to pass the script the version number to use.

set -e

version=${1?}
host=`uname -n`
if [ "${SOURCE_DATE_EPOCH}" != "" ]; then
    host="`dpkg-vendor --query Vendor`"
fi
if test -d "$srcdir/.git"; then
    git=" `git -C $srcdir describe --long --dirty`"
else
    git=
fi
date="$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" '+%B %d, %Y')"

cat <<E
char *version_str = "nmh-$version$git built $date on $host";
char *version_num = "nmh-$version";
char *user_agent = "nmh/$version";
E