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

Revision 23924, 3.2 KB checked in by broder, 15 years ago (diff)
In sendbug: * Debathena is no longer beta.
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      if ! subject=$(zenity --entry --text="$text"); then
36          exit
37      fi
38  else
39    echo "$text" || fmt
40    echo -n ' --> '
41    read subject
42  fi
43fi
44
45cat > $report_file << EOF
46To: $bugs_address
47Subject: Debathena: $subject
48
49System name:            $hostname
50Type:                   $cpu
51Display type:           $dpy
52
53Shell:                  $shell
54Window manager:         ${WINDOW_MANAGER:-unknown}
55
56What were you trying to do?
57        [Please replace this line with your information.]
58
59What's wrong:
60        [Please replace this line with your information.]
61
62What should have happened:
63        [Please replace this line with your information.]
64
65Please describe any relevant documentation references:
66        [Please replace this line with your information.]
67EOF
68
69if [ true = "$gnome" ]; then
70  text="After you click OK, an editor window will appear with the bug report"
71  text="$text contents.  Please fill out the form, then save and exit.  If"
72  text="$text you change your mind, you will have a chance to cancel before"
73  text="$text the bug report is sent."
74  zenity --info --text="$text"
75  gnome-text-editor "$report_file"
76  # zenity doesn't let us specify the buttons on a question, and the
77  # list dialog is awkward.  So while we'd like to do something more
78  # like what we do in the terminal case, we'll compromise a bit.
79  question="Do you still want to send the bug report?"
80  if ! zenity --question --text="$question"; then
81    text="Cancelled.  Your text is in $report_file if you wish to recover it."
82    zenity --info --no-wrap --text="$text"
83    exit
84  fi
85
86  if $sendmail < $report_file; then
87    text="Thank you for your bug report."
88    zenity --info --text="$text"
89  else
90    text="Failed to send the bug report!  Please contact x3-4435 for"
91    text="$text\nassistance.  Your text is in $report_file"
92    text="$text\nif you wish to recover it."
93    zenity --error --no-wrap --text="$text"
94  fi
95else
96  fmt << EOF
97
98Please fill in the specified fields of the bug report form, which will
99be displayed momentarily.
100Remember to save the file before exiting the editor.
101EOF
102  : ${EDITOR=emacs}
103  $EDITOR "$report_file"
104  while true; do
105    fmt << EOF
106
107Please enter "send" to send the report, "edit" to re-edit it, or
108"quit" to quit.
109EOF
110    echo -n ' --> '
111    read reply
112    [ send = "$reply" ] && break
113    [ quit = "$reply" ] && exit
114    [ edit = "$reply" ] && $EDITOR "$report_file"
115  done
116
117  if $sendmail < $report_file; then
118    echo "Thank you for your bug report."
119  else
120    fmt << EOF
121Failed to send the bug report!  Please contact x3-4435 for assistance.
122Your text is in $report_file if you wish to recover it.
123EOF
124  fi
125fi
Note: See TracBrowser for help on using the repository browser.