File: version.sh

package info (click to toggle)
nmh 1.0.2-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 3,172 kB
  • ctags: 4,449
  • sloc: ansic: 50,696; sh: 1,799; makefile: 1,192; awk: 74; sed: 17
file content (44 lines) | stat: -rwxr-xr-x 808 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# version.sh -- script to create version string(s) for nmh.
#
# You need to pass the script the version number to use.
#
# $Id: version.sh,v 1.1.1.1 1999/04/30 18:08:34 doug Exp $
#

if [ -z "$1" ]; then
    echo "usage: version.sh VERSION" 1>&2
    exit 1
fi

VERSION=$1
OFS="$IFS"
IFS=:
HOSTNAME=unknown

# Find out the name of the host we are compiling on
for prog in uname hostname
do
    for dir in $PATH
    do
	if [ ! -f $dir/$prog ]; then
	    continue
	fi
	case $prog in
	    uname)	HOSTNAME=`$prog -n`
			;;
	    hostname)	HOSTNAME=`$prog`
			;;
	esac
	break
    done
    if [ X"$HOSTNAME" != X  -a  X"$HOSTNAME" != Xunknown ]; then
	break
    fi
done

IFS=" "

echo "char *version_str = \"nmh-$VERSION [compiled on $HOSTNAME at `date`]\";"
echo "char *version_num = \"nmh-$VERSION\";"