1 | #!/bin/sh |
---|
2 | # $Id: sendbug.sh,v 1.16 1996-08-19 21:14:55 ghudson Exp $ |
---|
3 | |
---|
4 | # save PATH so we can restore it for user's $EDITOR later |
---|
5 | saved_path="$PATH" |
---|
6 | |
---|
7 | # make sure stuff this script needs is up front |
---|
8 | PATH=/srvd/patch:/usr/athena/bin:/bin/athena:/usr/bin/X11:/usr/ucb:/bin:/usr/bin:/usr/bsd:/usr/sbin |
---|
9 | export PATH |
---|
10 | |
---|
11 | bugs_address=bugs@MIT.EDU |
---|
12 | sendmail="/usr/lib/sendmail -t -oi" |
---|
13 | report_file=/tmp/bug$$.text |
---|
14 | if [ ! -r /etc/athena/version -a -r /etc/version ]; then |
---|
15 | version_file=/etc/version |
---|
16 | else |
---|
17 | version_file=/etc/athena/version |
---|
18 | fi |
---|
19 | if [ ! -r $version_file ]; then |
---|
20 | version="unknown version (no $version_file found)" |
---|
21 | else |
---|
22 | awk_cmd='\ |
---|
23 | {if ($5 == "Update") update++; \ |
---|
24 | else if ($5 == version) { same++; update=0; } \ |
---|
25 | else { version=$5; update=0; same=0; } } ; \ |
---|
26 | END { printf "%s", version; \ |
---|
27 | close1=0; \ |
---|
28 | if (update) { printf " (plus partial update"; close1=1; }\ |
---|
29 | else if (same) { \ |
---|
30 | if (close1) printf "; "; \ |
---|
31 | else printf " ("; \ |
---|
32 | printf "%d update(s) to same version", same; \ |
---|
33 | close1=1; } \ |
---|
34 | if (close1) printf ")"; \ |
---|
35 | }' |
---|
36 | version=`awk "$awk_cmd" < $version_file` |
---|
37 | fi |
---|
38 | short_version=`expr "$version (" : '\([^(]*[^( ]\) *(.*'` |
---|
39 | machtype=`machtype` |
---|
40 | cpu=`machtype -c` |
---|
41 | hostname=`hostname` |
---|
42 | dpy=`machtype -d` |
---|
43 | fmt << EOF |
---|
44 | Please enter the name of the program or locker with which you are |
---|
45 | having problems. You may first want to check with the consultants to |
---|
46 | see if there is a known workaround to this problem; hit ctrl-c now and |
---|
47 | type 'olc' at your athena% prompt to enter a question. |
---|
48 | EOF |
---|
49 | echo -n ' --> ' |
---|
50 | read subject |
---|
51 | cat > $report_file << EOF |
---|
52 | To: $bugs_address |
---|
53 | Subject: $machtype $short_version: $subject |
---|
54 | ------- |
---|
55 | System name: $hostname |
---|
56 | Type and version: $cpu $version |
---|
57 | Display type: $dpy |
---|
58 | |
---|
59 | What were you trying to do? |
---|
60 | [Please replace this line with your information.] |
---|
61 | |
---|
62 | What's wrong: |
---|
63 | [Please replace this line with your information.] |
---|
64 | |
---|
65 | What should have happened: |
---|
66 | [Please replace this line with your information.] |
---|
67 | |
---|
68 | Please describe any relevant documentation references: |
---|
69 | [Please replace this line with your information.] |
---|
70 | EOF |
---|
71 | |
---|
72 | fmt << EOF |
---|
73 | |
---|
74 | Please fill in the specified fields of the bug report form, which will |
---|
75 | be displayed momentarily. |
---|
76 | Remember to save the file before exiting the editor. |
---|
77 | EOF |
---|
78 | |
---|
79 | if [ -r "${MH-$HOME/.mh_profile}" ]; then |
---|
80 | PATH="$saved_path" /usr/athena/bin/comp -form "$report_file" |
---|
81 | rm "$report_file" |
---|
82 | exit 0 |
---|
83 | fi |
---|
84 | # not using MH; run the editor, and send, ourselves. |
---|
85 | MH=/dev/null; export MH |
---|
86 | if [ "${EDITOR}" = "" ]; then |
---|
87 | EDITOR=/usr/athena/bin/emacs ; export EDITOR |
---|
88 | fi |
---|
89 | |
---|
90 | PATH="$saved_path" exec whatnow -editor "$EDITOR" "$report_file" |
---|