#! /bin/sh # # importrel # # Shell script to import a release in the # the BaBar code system from another site # # Bob Jacobsen Mar 1995 # # (Test releases are not yet supported) # # Options: # -p Reference a production release. (required) # -a don't copy the contents of the bin, lib, tmp subdirectories # (i.e. allow user to use individual importarch commands) # -g use gtar instead if tar (useful for AIX4.1) # Arguments: # Number of release # # 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" # # It would be very useful to only tar and transmit "interesting" # subdirectories based on which BFARCH values a site wants to # receive. # ################################################################ # process options test=0 prod=0 tar="tar" nolib=0 #amj:FNAL: getopts has replaced getopt as recommended usage on SGI and # DECUnix. Only getopts exists in the cygnus NT system. while getopts pag c do case $c in p) prod=1; test=0;; a) nolib=1;; 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 1 ]; then echo "One argument required" exit 2 fi release=$1 # make sure the release directory exists if [ -r $BFDIST/releases ]; then : else mkdir $BFDIST/releases 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 release here if [ -r $BFDIST/releases/$release ]; then echo Release $release already 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 if [ "$nolib" -ne 1 ]; then # copy all the contents cd $BFDIST/releases $rsh $remsite $remuser \(cd $rempathname/releases\; $tar cf - $release \| $compress \) | $uncompress | $tar xf - else # omit lib, bin, tmp cd $BFDIST/releases mkdir $release cd $release filelist=`$rsh $remsite $remuser ls $rempathname/releases/$release| grep -v "^bin" | grep -v "^lib" | grep -v "^tmp"` $rsh $remsite $remuser \(cd $rempathname/releases/$release\; tar cf - $filelist \| $compress \) | $uncompress | tar xf - fi # and pick up the versions if needed for var in `ls $BFDIST/releases/$release` do line=`ls -ltd $BFDIST/releases/$release/$var | grep -i " ->"` if [ "$line" ]; then OIFS=$IFS IFS=/ set $line IFS=$OIFS shiftcount=`expr $# - 2` shift $shiftcount package=$1 version=$2 echo importver -p $package $version importver -p $package $version fi done exit