source: trunk/athena/bin/sendbug/sendbug.sh @ 23526

Revision 23526, 3.2 KB checked in by broder, 16 years ago (diff)
In sendbug: * Change "Athena 10" to "Debathena Beta" in the bug report template.
Line 
1#!/bin/sh
2# $Id: sendbug.sh,v 1.21 2003-07-30 19:16:12 zacheiss Exp $
3
4visual=false
5if [ x--gnome = x"$1" ]; then
6  # This is how we are invoked from the panel menu
7  gnome=true
8  shift
9fi
10subject=$1
11bugs_address=bugs@mit.edu
12sendmail="/usr/sbin/sendmail -t -oi"
13report_file=$(mktemp -t "sendbug.$USER.XXXX")
14machtype=$(machtype)
15cpu=$(machtype -c)
16hostname=$(hostname)
17dpy=$(machtype -d)
18
19shell=`awk -F: '/^'$USER':/ { print $7; exit; }' /etc/passwd 2>/dev/null`
20case $shell in
21$SHELL)
22  ;;
23"")
24  shell="$SHELL (?)"
25  ;;
26*)
27  shell="$shell ($SHELL?)"
28  ;;
29esac
30
31if [ -z "$subject" ]; then
32  text="Please enter the name of the program or locker with which you are"
33  text="$text having problems."
34  if [ true = "$gnome" ]; then
35    subject=$(zenity --entry --text="$text")
36  else
37    echo "$text" || fmt
38    echo -n ' --> '
39    read subject
40  fi
41fi
42
43cat > $report_file << EOF
44To: $bugs_address
45Subject: Debathena Beta: $subject
46
47System name:            $hostname
48Type:                   $cpu
49Display type:           $dpy
50
51Shell:                  $shell
52Window manager:         ${WINDOW_MANAGER:-unknown}
53
54What were you trying to do?
55        [Please replace this line with your information.]
56
57What's wrong:
58        [Please replace this line with your information.]
59
60What should have happened:
61        [Please replace this line with your information.]
62
63Please describe any relevant documentation references:
64        [Please replace this line with your information.]
65EOF
66
67if [ true = "$gnome" ]; then
68  text="After you click OK, an editor window will appear with the bug report"
69  text="$text contents.  Please fill out the form, then save and exit.  If"
70  text="$text you change your mind, you will have a chance to cancel before"
71  text="$text the bug report is sent."
72  zenity --info --text="$text"
73  gnome-text-editor "$report_file"
74  # zenity doesn't let us specify the buttons on a question, and the
75  # list dialog is awkward.  So while we'd like to do something more
76  # like what we do in the terminal case, we'll compromise a bit.
77  question="Do you still want to send the bug report?"
78  if ! zenity --question --text="$question"; then
79    text="Cancelled.  Your text is in $report_file if you wish to recover it."
80    zenity --info --no-wrap --text="$text"
81    exit
82  fi
83
84  if $sendmail < $report_file; then
85    text="Thank you for your bug report."
86    zenity --info --text="$text"
87  else
88    text="Failed to send the bug report!  Please contact x3-4435 for"
89    text="$text\nassistance.  Your text is in $report_file"
90    text="$text\nif you wish to recover it."
91    zenity --error --no-wrap --text="$text"
92  fi
93else
94  fmt << EOF
95
96Please fill in the specified fields of the bug report form, which will
97be displayed momentarily.
98Remember to save the file before exiting the editor.
99EOF
100  : ${EDITOR=emacs}
101  $EDITOR "$report_file"
102  while true; do
103    fmt << EOF
104
105Please enter "send" to send the report, "edit" to re-edit it, or
106"quit" to quit.
107EOF
108    echo -n ' --> '
109    read reply
110    [ send = "$reply" ] && break
111    [ quit = "$reply" ] && exit
112    [ edit = "$reply" ] && $EDITOR "$report_file"
113  done
114
115  if $sendmail < $report_file; then
116    echo "Thank you for your bug report."
117  else
118    fmt << EOF
119Failed to send the bug report!  Please contact x3-4435 for assistance.
120Your text is in $report_file if you wish to recover it.
121EOF
122  fi
123fi
Note: See TracBrowser for help on using the repository browser.