Moved InstallVersion to extensions.
This commit is contained in:
@@ -1,116 +0,0 @@
|
||||
#!/bin/sh
|
||||
####!/bin/sh -xv
|
||||
|
||||
# InstallVerson
|
||||
#
|
||||
# InstallVerson is used within makefiles to copy new versions of
|
||||
# files into a destination directory with file version numbering.
|
||||
#
|
||||
#
|
||||
# Author: JanetAnderson (ANL)
|
||||
# Date: 7/18/94
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.1 1996/02/20 20:58:35 jba
|
||||
# Moved tools to src/tools dir. base/tools dir removed.
|
||||
#
|
||||
# Revision 1.3 1994/12/07 15:13:03 jba
|
||||
# Modified comments
|
||||
#
|
||||
# Revision 1.2 1994/11/09 22:11:20 jba
|
||||
# Allow filename parm to include relative dir location
|
||||
#
|
||||
# Revision 1.1 1994/09/07 20:50:38 jba
|
||||
# Files for extensions
|
||||
#
|
||||
#
|
||||
##########################################################
|
||||
#
|
||||
# Find the last version number of an installed tool.
|
||||
#
|
||||
get_new_version ()
|
||||
{
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
echo Usage: $0 toolname
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=`ls $1.* 2>/dev/null | tail -1 | nawk -F'.' '{ printf "%05d", $NF + 1 }'`
|
||||
|
||||
if [ -z "$VERSION" ]
|
||||
then
|
||||
echo 00001
|
||||
else
|
||||
echo $VERSION
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
##########################################################
|
||||
TOOL=`basename $0`
|
||||
MODE=755
|
||||
USAGE="Usage:
|
||||
$TOOL [ -m mode ] file ... directory
|
||||
|
||||
-m mode Set the mode for the installed file (0755 by default)
|
||||
file Name of file
|
||||
directory Destination directory
|
||||
"
|
||||
# get command line options
|
||||
set -- `getopt m:g:o:csd $*`
|
||||
for i
|
||||
do
|
||||
case $i in
|
||||
-m) MODE=$2; shift 2;;
|
||||
-g | -o) echo $USAGE; echo "$i not implemented"; shift 2;;
|
||||
-c | -s | -d ) echo $USAGE; echo "$i not implemented"; shift;;
|
||||
--) shift; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
# at least two args required
|
||||
if [ $# -lt 2 ]
|
||||
then
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ADD_ON_BIN=
|
||||
FILELIST=
|
||||
for i
|
||||
do
|
||||
FILELIST="${FILELIST} ${ADD_ON_BIN}"; ADD_ON_BIN=$i; shift;
|
||||
done
|
||||
|
||||
if [ ! -d ${ADD_ON_BIN} ] ;then
|
||||
echo "$USAGE\n Can't find directory '${ADD_ON_BIN}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for FILE in ${FILELIST}
|
||||
do
|
||||
if [ ! -f ${FILE} ] ;then
|
||||
echo "$USAGE\n Can't find file '${FILE}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEST=
|
||||
FILEBASENAME=`basename ${FILE}`
|
||||
if [ -f ${ADD_ON_BIN}/${FILEBASENAME} ] ; then
|
||||
#Is ${ADD_ON_BIN}/${FILEBASENAME} link timestamp newer than ${FILE}
|
||||
TEST=`find ${ADD_ON_BIN} -name "${FILEBASENAME}" -newer ${FILE} -print`
|
||||
fi
|
||||
if [ "${TEST}x" = "x" ] ; then
|
||||
#echo "Installing ${FILEBASENAME}"
|
||||
/bin/rm -f ${ADD_ON_BIN}/${FILEBASENAME}
|
||||
VERSION_NAME=${FILEBASENAME}.`get_new_version ${ADD_ON_BIN}/${FILEBASENAME}`
|
||||
/bin/cp -p ${FILE} ${ADD_ON_BIN}/${VERSION_NAME}
|
||||
/bin/chmod ${MODE} ${ADD_ON_BIN}/${VERSION_NAME}
|
||||
/bin/ln -s ${VERSION_NAME} ${ADD_ON_BIN}/${FILEBASENAME}
|
||||
else
|
||||
echo "${ADD_ON_BIN}/${FILEBASENAME} is up to date"
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user