Expand PMF_FN_* macros.
[netbsd-mini2440.git] / gnu / usr.bin / send-pr / install-sid.sh
blob3478c2ac54247918649217fc683787a6bed6b370
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).
7 # This file is part of GNU GNATS.
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.
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.
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.
23 COMMAND=`echo $0 | sed -e 's,.*/,,g'`
24 USAGE="Usage: $COMMAND [--install-dir=prefix] [--help] [--version] submitter-id"
26 VERSION=xVERSIONx
28 BINDIR=xBINDIRx
30 SUBMITTER=
31 TEMP=/tmp/sp$$
33 if [ $# -eq 0 ]; then
34 echo "$USAGE"
35 exit 1
38 while [ $# -gt 0 ]; do
39 case "$1" in
40 -install-dir=*|--install-dir=*|--install-di=*|--install-d=*|--install-=*|--install=*|--instal=*|--insta=*|--inst=*|--ins=*|--in=*|--i=*)
41 I=`echo "$1" | sed 's/-*i[a-z\-]*=//'`
42 BINDIR=$I/bin ;;
43 --version) echo $COMMAND version $VERSION ; exit 1 ;;
44 -*) echo "$USAGE" ; exit 1 ;;
45 *) SUBMITTER=$1 ;;
46 esac
47 shift
48 done
50 path=`echo $0 | sed -e "s;${COMMAND};;"`
52 [ -z "$path" ] && path=.
54 if [ -f $BINDIR/send-pr ]; then
55 SPPATH=$BINDIR/send-pr
56 elif [ -f $path/send-pr ]; then
57 SPPATH=$path/send-pr
58 else
59 echo "$COMMAND: cannot find \`$BINDIR/send-pr' or \`$path/send-pr'" >&2
60 exit 1
63 trap 'rm -f $TEMP ; exit 0' 0
64 trap 'echo "$COM: Aborting ..."; rm -f $TEMP ; exit 1' 1 2 3 13 15
66 sed -e "s/^SUBMITTER=.*/SUBMITTER=${SUBMITTER}/" $SPPATH > $TEMP
68 if grep $SUBMITTER $TEMP > /dev/null; then
69 cp $SPPATH $SPPATH.orig &&
70 rm -f $SPPATH &&
71 cp $TEMP $SPPATH &&
72 chmod a+rx $SPPATH &&
73 rm -f $TEMP $SPPATH.orig ||
74 { echo "$COMMAND: unable to replace send-pr" >&2 ; exit 1; }
75 else
76 echo "$COMMAND: something went wrong when sed-ing the submitter into send-pr" >&2
77 exit 1
80 echo "$COMMAND: \`$SUBMITTER' is now the default submitter ID for send-pr"
82 exit 0