NetBSD/usr.sbin/ntp/scripts/mkver

47 lines
713 B
Bash
Executable File

#!/bin/sh
PROG=${1-UNKNOWN}
ConfStr="$PROG"
ConfStr="$ConfStr 4.2.4p8"
case "$CSET" in
'') ;;
*) ConfStr="$ConfStr@$CSET" ;;
esac
case "-lcrypto" in
'') ;;
-lcrypto)
ConfStr="${ConfStr}-o" ;;
*) ConfStr="${ConfStr}-?" ;;
esac
ifile="`dirname $0`/../importdate"
if [ -f "$ifile" ]; then
ConfStr="$ConfStr "`cat "$ifile"`
else
ConfStr="$ConfStr `LC_TIME=C TZ= date`"
if [ ! -f .version ]; then
echo 0 > .version
fi
RUN="`cat .version`"
RUN="`expr $RUN + 1`"
echo $RUN > .version
ConfStr="$ConfStr (${RUN})"
fi
echo "Version <${ConfStr}>";
rm -f version.c
cat > version.c << -EoF-
/*
* version file for $PROG
*/
#include <config.h>
const char * Version = "${ConfStr}";
-EoF-