home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / gnu / packgnu.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1994-09-07  |  2KB  |  73 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. # either by looking for an appropriate *-pi file in the manifests subdir,
  7. # or from the Product-Info in the appropriate source subdir.
  8.  
  9. workdir=/build/gnu-pack-junk
  10. toolsrcdir=src/amiga
  11. rootdir=GNU
  12. manifests=manifests
  13. bbsdir=BBS:$rootdir
  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.  
  23. for tool in `(cd $manifests; echo *-src *-bin *-diffs)`
  24. do
  25.     echo "========="
  26.  
  27.     # Remove any old trash and create a fresh working directory.
  28.  
  29.     if test -d $workdir/$rootdir
  30.     then
  31.         echo "rm -rf $workdir/$rootdir"
  32.         rm -rf $workdir/$rootdir
  33.     fi
  34.     echo "mkdir -p $workdir/$rootdir"
  35.     mkdir -p $workdir/$rootdir
  36.  
  37.     # Make a copy of all files that we want in the archive under
  38.     # $workdir/$rootdir.  The files listed in the manifests files
  39.     # are relative to the current working directory (GNU).
  40.  
  41.     echo "tar -c -T $manifests/$tool -f $workdir/$rootdir/tar.out"
  42.     tar -c -T $manifests/$tool -f $workdir/$rootdir/tar.out
  43.     echo "(cd $workdir/$rootdir && tar -xf tar.out && rm tar.out)"
  44.     (cd $workdir/$rootdir && tar -xf tar.out && rm tar.out)
  45.  
  46.     # Now make an lha archive in $workdir that is rooted in $rootdir,
  47.     # and if successful, copy it to the BBS/$rootdir directory.
  48.  
  49.     echo "(cd $workdir && lha -mraxeq a $tool.lha $rootdir && cp $tool.lha $bbsdir/$tool.lha)"
  50.     (cd $workdir && lha -mraxeq a $tool.lha $rootdir && cp $tool.lha $bbsdir/$tool.lha)
  51.  
  52.     # Locate an appropriate product info file and install a copy of the product
  53.     # info file alongside the archive.
  54.  
  55.     pifilein=""
  56.     pifileout="$bbsdir/$tool.lha.pi"
  57.     srcname=`echo $tool | sed -e "s:-src::" -e "s:-bin::" -e "s:-diffs::"`
  58.     if test -f $manifests/$tool-pi
  59.     then
  60.         pifilein="$manifests/$tool-pi"
  61.     elif test -f $toolsrcdir/$srcname/Product-Info
  62.     then
  63.         pifilein="$toolsrcdir/$srcname/Product-Info"
  64.     fi
  65.     if test -n "$pifilein"
  66.     then
  67.         echo "cp $pifilein $pifileout"
  68.         cp $pifilein $pifileout
  69.     else
  70.         echo "WARNING: no product info file found to generate $pifileout"
  71.     fi
  72. done
  73.