home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / gnu / pack.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1994-11-20  |  2KB  |  78 lines

  1. #! /bin/sh
  2. #
  3. # Create archives for the BBS section of this CD from various parts of the
  4. # GNU tree.  To help guide this process, the files in the manifests subdir
  5. # list the contents of each archive.  The associated product info file is
  6. # found either by looking for an appropriate *-pi file in the manifests
  7. # subdir, or from the Product-Info in the appropriate source subdir.
  8.  
  9. workdir=/Scratch/packtemp
  10. toolsrcdir=src/amiga
  11. manifests=manifests
  12. bbsgnudir=GNU
  13. bbsdir=/BBS/$bbsgnudir
  14.  
  15. # Check to see that the output BBS directory exists.  If not, create it.
  16.  
  17. if test ! -d $bbsdir
  18. then
  19.     echo "mkdir -p $bbsdir"
  20.     mkdir -p $bbsdir
  21. fi
  22. if test ! -d $workdir
  23. then
  24.     echo "mkdir -p $workdir"
  25.     mkdir -p $workdir
  26. fi
  27.  
  28. for tool in `(cd $manifests; echo *-src *-bin *-diffs)`
  29. do
  30.     echo "========="
  31.  
  32.     # Remove any old trash and create a fresh working directory.
  33.  
  34.     if test -d $workdir/$bbsgnudir
  35.     then
  36.         echo "rm -rf $workdir/$bbsgnudir"
  37.         rm -rf $workdir/$bbsgnudir
  38.     fi
  39.     echo "mkdir -p $workdir/$bbsgnudir"
  40.     mkdir -p $workdir/$bbsgnudir
  41.  
  42.     # Make a copy of all files that we want in the archive under
  43.     # $workdir/$bbsgnudir.  The files listed in the manifests files
  44.     # are relative to the current working directory (GNU).
  45.  
  46.     echo "tar -c -T $manifests/$tool -f $workdir/$bbsgnudir/tar.out"
  47.     tar -c -T $manifests/$tool -f $workdir/$bbsgnudir/tar.out
  48.     echo "(cd $workdir/$bbsgnudir && tar -xf tar.out && rm tar.out)"
  49.     (cd $workdir/$bbsgnudir && tar -xf tar.out && rm tar.out)
  50.  
  51.     # Now make an lha archive in $workdir that is rooted in $bbsgnudir,
  52.     # and if successful, copy it to the BBS/$bbsgnudir directory.
  53.  
  54.     echo "(cd $workdir && lha -mraxeq a $tool.lha $bbsgnudir && cp $tool.lha $bbsdir/$tool.lha)"
  55.     (cd $workdir && lha -mraxeq a $tool.lha $bbsgnudir && cp $tool.lha $bbsdir/$tool.lha)
  56.  
  57.     # Locate an appropriate product info file and install a copy of the product
  58.     # info file alongside the archive.
  59.  
  60.     pifilein=""
  61.     pifileout="$bbsdir/$tool.lha.pi"
  62.     srcname=`echo $tool | sed -e "s:-src::" -e "s:-bin::" -e "s:-diffs::"`
  63.     if test -f $manifests/$tool-pi
  64.     then
  65.         pifilein="$manifests/$tool-pi"
  66.     elif test -f $toolsrcdir/$srcname/Product-Info
  67.     then
  68.         pifilein="$toolsrcdir/$srcname/Product-Info"
  69.     fi
  70.     if test -n "$pifilein"
  71.     then
  72.         echo "cp $pifilein $pifileout"
  73.         cp $pifilein $pifileout
  74.     else
  75.         echo "WARNING: no product info file found to generate $pifileout"
  76.     fi
  77. done
  78.