Add "BugOpts QtDragnDropWorkaround"
[fvwm.git] / bin / fvwm-bug.in
blobf41f2d172c21331165802b9bf65edfbc4deb4bf7
1 #!/bin/sh -
3 # fvwm-bug - create a bug report and mail it to the bug address
4 # - adapted from equivalent `bashbug' script
6 # The bug address could depend on the release status of fvwm. Currently
7 # it doesn't.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 PACKAGE="@PACKAGE@"
27 VERSION="@VERSION@"
28 script=`basename $0`
29 address=""
31 while test $# -gt 0; do
32 case "$1" in
33 --help|-help|-h|-\?)
34 cat <<EOF
35 This script is a part of $PACKAGE-$VERSION package.
37 Usage: $script [OPTIONS] [address]
38 Options:
39 [-h] [--help] [-?]
40 [-v] [--version] [-V]
42 address is an alternative email address to send the bug report to;
43 by default, addresses of the local admin or developers are used
44 EOF
45 exit 0 ;;
47 --version|-version|-v|-V)
48 echo "$VERSION"
49 exit 0 ;;
51 -*)
52 echo >&2 "Unrecognized option $1 specified."
53 echo >&2 "Run '$0 --help' to get the usage."
54 exit 1 ;;
57 if test x"$address" != x; then
58 echo >&2 "You may specify only one address."
59 echo >&2 "Run '$0 --help' to get the usage."
60 exit 1
62 address="$1" ;;
63 esac
64 shift
65 done
67 PATH=/bin:/usr/bin:/usr/local/bin:$PATH
68 export PATH
70 : ${EDITOR:=vi}
72 TEMP=`mktemp -q "${TMPDIR:-/tmp}/fvwm-bug.XXXXXX"`
74 # Figure out how to echo a string without a trailing newline
75 N=`echo 'hi there\c'`
76 case "$N" in
77 *c) n=-n c= ;;
78 *) n= c='\c' ;;
79 esac
81 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
82 trap 'rm -f $TEMP $TEMP.x' 0
84 # Who is mail from?
85 : ${USER:=${LOGNAME:-`whoami`}}
87 # Who is mail to?
88 if test x"$address" = x; then
89 LOCAL=@LOCAL_BUGADDR@
90 WORKERS=fvwm-workers@fvwm.org
92 if test "$LOCAL"; then
93 echo "Do you want to send the report to the local maintainer <$LOCAL>,"
94 echo "the fvwm workers <$WORKERS>, or both?"
95 echo $n "Send report to (l)ocal, (w)orkers, (b)oth? " $c
96 read ans
97 case "$ans" in
98 l*|L*) BUGADDR=$LOCAL;;
99 f*|F*|w*|W*) BUGADDR=$WORKERS;;
100 b*|B*) BUGADDR=$LOCAL,$WORKERS;;
101 *) echo "[Defaulting to LOCAL]"; BUGADDR=$LOCAL;;
102 esac
104 else
105 BUGADDR=$address
109 if (uname) >/dev/null 2>&1; then
110 UN=`uname -a`
113 if [ -f /usr/lib/sendmail ] ; then
114 RMAIL="/usr/lib/sendmail"
115 elif [ -f /usr/sbin/sendmail ] ; then
116 RMAIL="/usr/sbin/sendmail"
117 else
118 RMAIL=rmail
122 prefix=@prefix@
123 exec_prefix=@exec_prefix@
124 datarootdir=@datarootdir@
125 datadir=@datadir@
126 libexecdir=@libexecdir@
127 : ${FVWM_USERDIR:=unset}
128 FVWM_DATADIR=@FVWM_DATADIR@
129 FVWM_MODULEDIR=@FVWM_MODULEDIR@
132 cat > $TEMP <<EOF
133 From: ${USER}
134 To: ${BUGADDR}
135 Subject: [50 character or so descriptive subject here (for reference)]
137 Configuration Information [Automatically generated, do not change]:
138 uname: $UN
139 compiler flags: @CC@ @CFLAGS@
141 FVWM Version: @VERSION@@VERSIONINFO@
142 FVWM_MODULEDIR: $FVWM_MODULEDIR
143 FVWM_DATADIR: $FVWM_DATADIR
144 FVWM_USERDIR: $FVWM_USERDIR
146 Description:
147 [Detailed description of the problem, suggestion, or complaint.]
149 Repeat-By:
150 [Describe the sequence of events that causes the problem
151 to occur.]
153 Fix:
154 [Description of how to fix the problem. If you don't know a
155 fix for the problem, don't include this section.]
158 chmod u+w $TEMP
159 cp $TEMP $TEMP.x
161 trap '' 2 # ignore interrupts while in editor
163 until $EDITOR $TEMP; do
164 echo "$0: editor \`$EDITOR' exited with nonzero status."
165 echo "$0: Perhaps it was interrupted."
166 echo "$0: Type \`y' to give up, and lose your bug report;"
167 echo "$0: type \`n' to re-enter the editor."
168 echo $n "$0: Do you want to give up? $c"
170 read ans
171 case "$ans" in
172 [Yy]*) exit 1 ;;
173 esac
174 done
176 trap 'rm -f $TEMP $TEMP.x; exit 1' 2 # restore trap on SIGINT
178 if cmp -s $TEMP $TEMP.x
179 then
180 echo "File not changed, no bug report submitted."
181 exit
184 echo $n "Send bug report? [y/n] $c"
185 read ans
186 case "$ans" in
187 [Nn]*) exit 0 ;;
188 esac
190 ${RMAIL} $BUGADDR < $TEMP || {
191 cat $TEMP >> $HOME/dead.fvwm-bug
192 echo "$0: mail failed: report saved in $HOME/dead.fvwm-bug" >&2
195 exit 0