#! /bin/bash -
#
# mksnap -- make a snapshot copy of the bash source tree in a new directory
#	    named by the date
#
# Chet Ramey
# chet@po.cwru.edu

# Copyright (C) 1996-2002 by Chester Ramey
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.

SRCDIR="src"
SRCARG="-s src"
ROOTNAME="-r bash"

usage()
{
	echo usage: mksnap [-m manifest] [-s srcdir] [-r rootname] [-v] 1>&2
	exit 2
}

vmsg()
{
	if [ -n "$verbose" ]; then
		echo mksnap: "$@"
	fi
}

while getopts m:s:r:v name
do
	case $name in
	m)	MANIFEST="-m $OPTARG" ;;
	s)	SRCDIR="$OPTARG" SRCARG="-s $OPTARG" ;;
	r)	ROOTNAME="-r $OPTARG" ;;
	v)	verbose=-v ;;
	?)	usage ;;
	esac
done

VERSION=`date "+%Y%m%d"`

vmsg calling mkdist $verbose

/bin/bash $SRCDIR/support/mkdist $verbose $SRCARG $MANIFEST $ROOTNAME $VERSION

exit 0
