#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution. 
#*************************************************************************
#!/bin/sh
#
#  $Id$
#
#           Author: Matthew Needes
#

USAGE="Usage:
        getrel <EpicsNodeFullPathName> 

ex:     getrel  /usr/local/epics/base_R3.13
        --------- OR -----------
        getrel  ~/epics/base 

"

# one arg
if [ $# -lt 1 ]; then
        cat <<!message

$USAGE
!message
        exit
fi

BASE=${1}

if [ ! -d ${BASE}/bin -o \
     ! -d ${BASE}/dbd ]; then
        cat <<-!usage
    $USAGE

    ${BASE} does not appear to be an epics BASE root tree...

!usage
    exit 1
fi

FIRSTCHAR=`expr "${BASE}" : '\(.\).*'`
if [ ${FIRSTCHAR} != "/" ]; then
        cat <<-!usage
    $USAGE

    ${BASE} does not appear to be a full path name.

!usage
    exit 1
fi


/bin/rm -f \
	EPICS_BASE \
	epics \
	base \
	target* \
	vxWorks* \
	vw

echo EPICS_BASE=${BASE} > EPICS_BASE

touch .current_rel_hist
echo ${BASE} - `date` >> .current_rel_hist

exit 0
