#! /bin/sh
##############################################################################
# This file is part of the VChat conference server distribution. #
# #
# Copyright (c) 1993 - 2006 Andreas S. Wetzel #
# All rights reserved. #
# #
# The contents of this file are subject to the terms of the GNU General #
# Public License (GPL), version 2 only ("the License") as published by the #
# Free Software Foundation. #
# #
# This Software comes with ABSOLUTELY NO WARRANTY. #
# See the License for more details. You should have received a copy of the #
# License along with this distribution; See the file COPYING. If not, write #
# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, #
# Boston, MA 02110-1301 USA. #
##############################################################################
# $Id: version.sh,v 1.3 2006/08/20 17:11:02 mickey Exp $
versfile="`dirname $0`/version.m4"
usage()
{
echo
echo "==========================================================================="
echo " version.sh -- Retrieve package version information from M4 version file"
echo "==========================================================================="
echo
if [ $# -gt 0 ]; then
echo "$0: $*"
echo
fi
echo "USAGE: $0 [-a] [-b] [-d] [-p] [-P] [-t] [-T] [-v]"
echo
echo "OPTIONS: -a Same as -P -d -T -b"
echo " -b Print package bug-report address"
echo " -d Print package release date"
echo " -p Print package long name"
echo " -P Print package long name with version"
echo " -t Print package tarball basename"
echo " -T Print package tarball complete name"
echo " -v Print package version number"
echo
}
if [ $# -le 0 ]; then
usage
exit 0
fi
for i in $*; do
case $i in
-a) $0 -P -d -T -b
;;
-b) awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_BUGADDR") print $4}' $versfile
;;
-d) awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_RELDATE") print $4}' $versfile
;;
-p) awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_PACKAGE") print $4}' $versfile
;;
-P) vers="`awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_VERSION") print $4}' $versfile`"
name="`awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_PACKAGE") print $4}' $versfile`"
echo "${name} ${vers}"
;;
-t) awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_TARNAME") print $4}' $versfile
;;
-T) vers="`awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_VERSION") print $4}' $versfile`"
tarb="`awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_TARNAME") print $4}' $versfile`"
echo "${tarb}-${vers}.tar.gz"
;;
-v) awk 'BEGIN{FS="[\[]*|[\]]+" }{if($2=="VC_VERSION") print $4}' $versfile
;;
*) usage "unrecognized option '${i}' encountered."
;;
esac
done
exit 0
syntax highlighted by Code2HTML, v. 0.9.1