home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Unix / cvs-960311 / lib / cvs / examples / wrap < prev   
Encoding:
Text File  |  1996-01-19  |  860 b   |  22 lines

  1. #! /bin/sh
  2. #
  3. #    wrap - Combine a directory into a single tar package.
  4. #
  5. #ident    "@(#)cvs/examples:$Name:  $:$Id: wrap,v 1.1.1.1 1996/01/20 15:41:04 bbum Exp $"
  6.  
  7. # This script is always called with the current directory set to
  8. # where the file to be combined exists. but i may get called with a
  9. # path to where cvs first started executing. (this probably should be
  10. # fixed in cvs) so strip out all of the directory information. The
  11. # first sed expression will only work if the path has a leading /
  12. # if it doesn't the one in the if statement will work.
  13. DIRNAME=`echo $1 | sed -e "s|/.*/||g"`
  14. if [ ! -d $DIRNAME ] ; then
  15.       DIRNAME=`echo $1 | sed -e "s|.*/||g"`
  16. fi
  17. #
  18. # Now tar up the directory but we now will only get a relative path
  19. # even if the user did a cvs commit . at the top.
  20. #
  21. gnutar --preserve --sparse -cf - $DIRNAME | gzip --no-name --best -c > $2
  22.