home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / packgnu.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1995-01-26  |  2KB  |  82 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. toolsrcdir=src/amiga
  10. manifests=manifests
  11. bbsroot=$1
  12. bbsgnudir=GNU
  13. bbsdir=$bbsroot/$bbsgnudir
  14. WORKDIR=$2/GNUpack
  15.  
  16. # Check to see that the output BBS directory exists.  If not, create it.
  17.  
  18. if test ! -d $bbsdir
  19. then
  20.     echo "mkdir -p $bbsdir"
  21.     mkdir -p $bbsdir
  22. fi
  23. if test ! -d $WORKDIR
  24. then
  25.     echo "mkdir -p $WORKDIR"
  26.     mkdir -p $WORKDIR
  27. fi
  28.  
  29. for tool in `(cd $manifests; echo *-src *-bin *-diffs)`
  30. do
  31.     echo "========="
  32.  
  33.     # Remove any old trash and create a fresh working directory.
  34.  
  35.     if test -d $WORKDIR/$bbsgnudir
  36.     then
  37.         echo "rm -rf $WORKDIR/$bbsgnudir"
  38.         rm -rf $WORKDIR/$bbsgnudir
  39.     fi
  40.     echo "mkdir -p $WORKDIR/$bbsgnudir"
  41.     mkdir -p $WORKDIR/$bbsgnudir
  42.  
  43.     # Make a copy of all files that we want in the archive under
  44.     # $WORKDIR/$bbsgnudir.  The files listed in the manifests files
  45.     # are relative to the current working directory (GNU).
  46.  
  47.     echo "tar -cp -T $manifests/$tool -f $WORKDIR/$bbsgnudir/tar.out"
  48.     tar -cp -T $manifests/$tool -f $WORKDIR/$bbsgnudir/tar.out
  49.     echo "(cd $WORKDIR/$bbsgnudir && tar -xpf tar.out && rm tar.out)"
  50.     (cd $WORKDIR/$bbsgnudir && tar -xpf tar.out && rm tar.out)
  51.  
  52.     # Now make an lha archive in $WORKDIR that is rooted in $bbsgnudir,
  53.     # and if successful, copy it to the BBS/$bbsgnudir directory.
  54.  
  55.     echo "(cd $WORKDIR && lha -mraxeq a $tool.lha $bbsgnudir && cp $tool.lha $bbsdir/$tool.lha)"
  56.     (cd $WORKDIR && lha -mraxeq a $tool.lha $bbsgnudir && cp $tool.lha $bbsdir/$tool.lha)
  57.  
  58.     # Locate an appropriate product info file and install a copy of the product
  59.     # info file alongside the archive.
  60.  
  61.     pifilein=""
  62.     pifileout="$bbsdir/$tool.lha.pi"
  63.     srcname=`echo $tool | sed -e "s:-src::" -e "s:-bin::" -e "s:-diffs::"`
  64.     if test -f $manifests/$tool-pi
  65.     then
  66.         pifilein="$manifests/$tool-pi"
  67.     elif test -f $toolsrcdir/$srcname/Product-Info
  68.     then
  69.         pifilein="$toolsrcdir/$srcname/Product-Info"
  70.     elif test -f $toolsrcdir/$srcname-src.lha.pi
  71.     then
  72.         pifilein="$toolsrcdir/$srcname-src.lha.pi"
  73.     fi
  74.     if test -z "$pifilein"
  75.     then
  76.         echo "WARNING: no product info file found to generate $pifileout"
  77.     else
  78.         echo "cp $pifilein $pifileout"
  79.         cp $pifilein $pifileout
  80.     fi
  81. done
  82.