home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Unix / cvs-960311 / lib / cvs / contrib / repack < prev    next >
Encoding:
Text File  |  1996-01-12  |  1.9 KB  |  83 lines

  1. #!/bin/sh
  2. #
  3. #
  4. # This script takes a NEXTSTEP wrapper directory that has been placed
  5. # under CVS control as a group of individual files, and converts the
  6. # directory to a tar'ed and gzip package
  7. #
  8. # example if the input directory was Foo.nib with the files in Foo.nib
  9. # called data.classes,v and data.nib,v the result will be a file called
  10. # Foo.nib,v with all of the original revisions checked out of the original
  11. # directory and placed into the new package. (tar'ed and gziped)
  12. #
  13. # There is nothing that is NEXTSTEP specific in this shell script
  14. #
  15. # written by Vince DeMarco <vdemarco@bou.shl.com>
  16. #
  17.  
  18. if [ $# -eq 0 ] ; then
  19.     echo "Usage:" $0 "[files..]"
  20.     exit 0
  21. fi
  22.  
  23. for INPUT_FILE in $@ ; do
  24.  
  25.     if [ -d $INPUT_FILE ] ; then
  26.  
  27.         INPUT_BACKUP_FILE=$INPUT_FILE.bak
  28.         MAX_VERSION=0.0
  29.  
  30.         mv -f $INPUT_FILE $INPUT_BACKUP_FILE
  31.         cd $INPUT_BACKUP_FILE
  32.  
  33.         echo "Checked in by $0 - $INPUT_FILE" > /tmp/$$.logmsg
  34.  
  35.         for FILE in * ; do
  36.             VERSION=`rlog -b $FILE | grep head | awk '{ print $2 }'`
  37.             if [ $VERSION -ge $MAX_VERSION ] ; then
  38.                 MAX_VERSION=$VERSION
  39.                 MAX_FILE=$FILE
  40.             fi
  41.         done
  42.  
  43.         echo "Processing" $INPUT_FILE "max version is" $MAX_VERSION
  44.  
  45.         mkdir ../$INPUT_FILE
  46.  
  47.         for VERSION in `rlog -b $MAX_FILE | grep -v total | \
  48.                 grep revision | awk '{ print $2 }' | sort` ; do
  49.  
  50.             echo "\tversion" $VERSION
  51.  
  52.             rm -rf ../$INPUT_FILE/*
  53.  
  54.             for FILE in * ; do
  55.                 co -q -r$VERSION $FILE
  56.                 mv `basename $FILE ,v` ../$INPUT_FILE/
  57.             done
  58.  
  59.             cd ../
  60.             chmod -R u+w $INPUT_FILE
  61.             rm -rf $$.version
  62.             gnutar Spscf - $INPUT_FILE | gzip --no-name --best -c > $$.version
  63.             ci     -q \
  64.                 -r$VERSION \
  65.                 -m"Checked in by $0 file version $VERSION" \
  66.                 -t/tmp/$$.logmsg $$.version
  67.  
  68.             rcs -q -kb -l $$.version
  69.             cd $INPUT_BACKUP_FILE/
  70.         done
  71.  
  72.         rm -rf ../$INPUT_FILE
  73.         cd ..
  74.  
  75.         mv -f $$.version,v $INPUT_FILE,v
  76.         rm -f /tmp/$$.logmsg
  77.     else
  78.         echo $INPUT_FILE "is not a directory or doesn't exist"
  79.     fi
  80. done
  81.  
  82. exit 1
  83.