home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xmcd-1.4 / misc.d / makesrc.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1995-05-10  |  3.2 KB  |  127 lines

  1. #!/bin/sh
  2. #
  3. # @(#)makesrc.sh    5.3 94/12/28
  4. #
  5. # Make software source code release
  6. #
  7. #    xmcd  - Motif(tm) CD Audio Player
  8. #    cda   - Command-line CD Audio Player
  9. #    libdi - CD Audio Player Device Interface Library
  10. #
  11. #    Copyright (C) 1995  Ti Kan
  12. #    E-mail: ti@amb.org
  13. #
  14. #    This program is free software; you can redistribute it and/or modify
  15. #    it under the terms of the GNU General Public License as published by
  16. #    the Free Software Foundation; either version 2 of the License, or
  17. #    (at your option) any later version.
  18. #
  19. #    This program is distributed in the hope that it will be useful,
  20. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22. #    GNU General Public License for more details.
  23. #
  24. #    You should have received a copy of the GNU General Public License
  25. #    along with this program; if not, write to the Free Software
  26. #    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27. #
  28.  
  29. SRCLIST=misc.d/SRCLIST
  30. VERS=`grep "VERSION=" $SRCLIST | sed 's/^.*VERSION=//'`
  31. TMPDIR=/tmp/_makesrc.d
  32. ZFILE=xmcdsrc.tar.gz
  33. UUEFILE=xmcdsrc.uue
  34. COMPRESS=gzip
  35. UNCOMPRESS=gunzip
  36. ENCODE=uuencode
  37. DECODE=uudecode
  38.  
  39. # Use Sysv echo if possible
  40. if [ -x /usr/5bin/echo ]                # SunOS SysV echo
  41. then
  42.     ECHO=/usr/5bin/echo
  43. elif [ -z "`(echo -e a) 2>/dev/null | fgrep e`" ]    # GNU bash, etc.
  44. then
  45.     ECHO="echo -e"
  46. else                            # generic SysV
  47.     ECHO=echo
  48. fi
  49.  
  50. CURDIR=`pwd`
  51. if [ `basename "$CURDIR"` = misc.d ]
  52. then
  53.     cd ..
  54. elif [ ! -f install.sh ]
  55. then
  56.     $ECHO "You must run the makesrc.sh script while in the xmcd"
  57.     $ECHO "source code distribution top-level directory or in the"
  58.     $ECHO "misc.d subdirectory."
  59.     exit 1
  60. fi
  61.  
  62. if [ ! -r $SRCLIST ]
  63. then
  64.     $ECHO "Error: Cannot open $SRCLIST"
  65.     exit 2
  66. fi
  67.  
  68. $ECHO "Creating xmcd/cda version $VERS source code release...\n"
  69.  
  70. trap "rm -rf $TMPDIR $ZFILE $UUEFILE" 1 2 3 5 15
  71.  
  72. # Make temp directory and copy release files to it
  73. rm -rf $TMPDIR
  74. mkdir -p $TMPDIR/xmcd-$VERS
  75. for i in `awk '!/^#/ { print $1 }' $SRCLIST`
  76. do
  77.     $ECHO "\t$i"
  78.     DEST=`dirname $TMPDIR/xmcd-$VERS/$i`
  79.     mkdir -p $DEST >/dev/null 2>&1
  80.     cp $i $DEST
  81. done
  82.  
  83. $ECHO "\nFixing permissions..."
  84. (cd $TMPDIR; find xmcd-$VERS -type f -print | xargs chmod 444)
  85.  
  86. $ECHO "\nCreating \"$COMPRESS\"ed tar archive..."
  87. # Create tar archive and compress it
  88. (cd $TMPDIR; tar cf - xmcd-$VERS) | $COMPRESS >$ZFILE
  89.  
  90. $ECHO "\n\"$ENCODE\"ing..."
  91. $ECHO '
  92.  
  93. Instructions to unpack xmcd v_VERS_ source code release
  94. ----------------------------------------------------
  95.  
  96. The following is a "_COMPRESS_"ed and "_ENCODE_"ed tar archive
  97. containing the xmcd, cda and libdi source code files.  To extract,
  98. make a suitable source code directory for xmcd and save this
  99. message in a file "_UUEFILE_" in that directory.  Then, change
  100. to the directory and do the following:
  101.  
  102.     _DECODE_ _UUEFILE_
  103.     _UNCOMPRESS_ < _ZFILE_ | tar xvf -
  104.  
  105. Read the README and INSTALL files for further instructions.
  106.  
  107. ' | sed    -e "s/_VERS_/$VERS/g" \
  108.     -e "s/_UUEFILE_/$UUEFILE/g" \
  109.     -e "s/_ZFILE_/$ZFILE/g" \
  110.     -e "s/_COMPRESS_/$COMPRESS/g" \
  111.     -e "s/_UNCOMPRESS_/$UNCOMPRESS/g" \
  112.     -e "s/_ENCODE_/$ENCODE/g" \
  113.     -e "s/_DECODE_/$DECODE/g" >$UUEFILE
  114.  
  115. # Uuencode
  116. $ENCODE $ZFILE $ZFILE >>$UUEFILE
  117. $ECHO "\n\n\n" >>$UUEFILE
  118.  
  119. $ECHO ""
  120.  
  121. ls -l $ZFILE $UUEFILE
  122.  
  123. rm -rf $TMPDIR
  124.  
  125. exit 0
  126.  
  127.