#! /bin/sh # # importver # # Shell script to import a package version in the # the BaBar code system from another site # # Bob Jacobsen Mar 1995 # # Options: # -p Reference a production version. (required) # -g use gtar instead of tar (useful for AIX4.1) # # Arguments: # Name of package # Version to import # # Note that the directory structure is assumed to exist. # # Note that the BFDISTr environment variable should # contain an access route (similar to CVSROOTr), for # example "jake@unixhub.slac.stanford.edu:/nfs/juno/u5/dist" # # ################################################################ # process options test=0 prod=0 tar="tar" #amj:FNAL: getopts has replaced getopt as recommended usage on SGI and # DECUnix. Only getopts exists in the cygnus NT system. while getopts tpvg c do case $c in p) prod=1; test=0;; g) tar="gtar" esac done shift `expr $OPTIND - 1` if [ "$prod" -ne 1 ]; then echo "-p option is currently required" exit 2 fi # check for correct number of arguments if [ "$#" -ne 2 ]; then echo "Two arguments required" exit 2 fi package=$1 version=$2 # make sure the package directory exists if [ -r $BFDIST/packages/$package ]; then : else mkdir $BFDIST/packages/$package fi # parse the remote access # set the pathname OIFS=$IFS IFS=: set $BFDISTr IFS=$OIFS rempathname=$2 sitestring=$1 # find site and user OIFS=$IFS IFS=@ set $sitestring IFS=$OIFS if [ $# -eq 2 ]; then remuser=" -l $1 " else remuser="" fi shiftcount=`expr $# - 1` shift $shiftcount remsite=$1 # check existance of version here if [ -r $BFDIST/packages/$package/$version ]; then echo Package $package already has version $version here exit fi # some machines call 'rsh' 'remsh' ... rsh="rsh" if [ `echo $BFARCH | cut -c1-5` = HP-UX ]; then rsh="remsh" fi # OSF compress and uncompress truncate files compress="compress" uncompress="uncompress" if [ `echo $BFARCH | cut -c1-3` = OSF ]; then compress="cat" uncompress="cat" fi # copy it cd $BFDIST/packages/$package $rsh $remsite $remuser \(cd $rempathname/packages/$package\; $tar cf - $version \| $compress \)| $uncompress | $tar xf - exit