home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gnats-3.01 / send-pr / install-sid.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1993-04-14  |  2.2 KB  |  78 lines

  1. #!/bin/sh
  2. # Drop in the SUBMITTER id into a site's installed send-pr script.
  3. # Copyright (C) 1993 Free Software Foundation, Inc.
  4. # Contributed by Brendan Kehoe (brendan@cygnus.com), based on a
  5. # version written by Heinz G. Seidl (hgs@ide.com).
  6. #
  7. # This file is part of GNU GNATS.
  8. #
  9. # GNU GNATS is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2, or (at your option)
  12. # any later version.
  13. #
  14. # GNU GNATS is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with GNU GNATS; see the file COPYING.  If not, write to
  21. # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23. COMMAND=`echo $0 | sed -e 's,.*/,,g'`
  24. USAGE="Usage: $COMMAND [--install-dir=prefix] submitter-id"
  25.  
  26. VERSION=@VERSION@
  27.  
  28. BINDIR=@BINDIR@
  29.  
  30. SUBMITTER=
  31. TEMP=/tmp/sp$$
  32.  
  33. [ $# -eq 0 ] && ( echo "$USAGE"; exit 1 )
  34.  
  35. while [ $# -gt 0 ]; do
  36.   case "$1" in
  37.     -install-dir=*|--install-dir=*|--install-di=*|--install-d=*|--install-=*|--install=*|--instal=*|--insta=*|--inst=*|--ins=*|--in=*|--i=*)
  38.     I=`echo "$1" | sed 's/-*i[a-z\-]*=//'`
  39.     BINDIR=$I/bin ;;
  40.     -*) echo "$USAGE" ; exit 1 ;;
  41.     *) SUBMITTER=$1 ;;
  42.   esac
  43.   shift
  44. done
  45.  
  46. path=`echo $0 | sed -e "s;${COMMAND};;"`
  47.  
  48. [ -z "$path" ] && path=.
  49.  
  50. if [ -f $BINDIR/send-pr ]; then
  51.   SPPATH=$BINDIR/send-pr
  52. elif [ -f $path/send-pr ]; then
  53.   SPPATH=$path/send-pr
  54. else
  55.   echo "$COMMAND: cannot find \`$BINDIR/send-pr' or \`$path/send-pr'"
  56.   exit 1
  57. fi
  58.  
  59. trap 'rm -f $TEMP ; exit 0' 0
  60. trap 'echo "$COM: Aborting ..."; rm -f $TEMP ; exit 1' 1 2 3 13 15
  61.  
  62. sed -e "s/^SUBMITTER=.*/SUBMITTER=${SUBMITTER}/" $SPPATH > $TEMP
  63.  
  64. if grep -s $SUBMITTER $TEMP; then
  65.   cp $SPPATH $SPPATH.orig
  66.   chmod u+w $SPPATH
  67.   cp $TEMP $SPPATH
  68.   chmod a+rx $SPPATH
  69.   rm -f $TEMP $SPPATH.orig
  70. else
  71.   echo "$COMMAND: something went wrong when sed-ing the submitter into send-pr"
  72.   exit 1
  73. fi
  74.  
  75. echo "$COMMAND: \`$SUBMITTER' is now the default submitter ID for send-pr"
  76.  
  77. exit 0
  78.