1 | #!/bin/sh |
---|
2 | # $Id: sendbug.sh,v 1.17 1997-04-30 08:32:56 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 | version_file=/etc/athena/version |
---|
15 | if [ ! -r "$version_file" ]; then |
---|
16 | version="unknown version (no $version_file found)" |
---|
17 | else |
---|
18 | version=`awk ' |
---|
19 | /^Athena Workstation \([^\) ]*\) Version Update/ { |
---|
20 | update = 1; |
---|
21 | } |
---|
22 | /^Athena Workstation \([^\) ]*\) Version [0-9]/ { |
---|
23 | update = 0; |
---|
24 | mkserv_update = 0; |
---|
25 | mkserv = 0; |
---|
26 | if ($5 == version) { |
---|
27 | same++; |
---|
28 | } else { |
---|
29 | version = $5; |
---|
30 | same = 0; |
---|
31 | } |
---|
32 | } |
---|
33 | /^Athena Server \([^\) ]*\) Version Update/ { |
---|
34 | mkserv_update = 1; |
---|
35 | } |
---|
36 | /^Athena Server \([^\) ]*\) Version [0-9]/ { |
---|
37 | mkserv_update = 0; |
---|
38 | mkserv = 1; |
---|
39 | } |
---|
40 | END { |
---|
41 | printf "%s", version; |
---|
42 | if (same) |
---|
43 | printf " (%d update(s) to same version)", same; |
---|
44 | if (mkserv) |
---|
45 | printf " (with mkserv)"; |
---|
46 | if (mkserv_update) |
---|
47 | printf " (plus partial mkserv)"; |
---|
48 | if (update) |
---|
49 | printf " (plus partial update)"; |
---|
50 | }' "$version_file"` |
---|
51 | fi |
---|
52 | short_version=`expr "$version (" : '\([^(]*[^( ]\) *(.*'` |
---|
53 | machtype=`machtype` |
---|
54 | cpu=`machtype -c` |
---|
55 | hostname=`hostname` |
---|
56 | dpy=`machtype -d` |
---|
57 | fmt << EOF |
---|
58 | Please enter the name of the program or locker with which you are |
---|
59 | having problems. You may first want to check with the consultants to |
---|
60 | see if there is a known workaround to this problem; hit ctrl-c now and |
---|
61 | type 'olc' at your athena% prompt to enter a question. |
---|
62 | EOF |
---|
63 | echo -n ' --> ' |
---|
64 | read subject |
---|
65 | cat > $report_file << EOF |
---|
66 | To: $bugs_address |
---|
67 | Subject: $machtype $short_version: $subject |
---|
68 | ------- |
---|
69 | System name: $hostname |
---|
70 | Type and version: $cpu $version |
---|
71 | Display type: $dpy |
---|
72 | |
---|
73 | What were you trying to do? |
---|
74 | [Please replace this line with your information.] |
---|
75 | |
---|
76 | What's wrong: |
---|
77 | [Please replace this line with your information.] |
---|
78 | |
---|
79 | What should have happened: |
---|
80 | [Please replace this line with your information.] |
---|
81 | |
---|
82 | Please describe any relevant documentation references: |
---|
83 | [Please replace this line with your information.] |
---|
84 | EOF |
---|
85 | |
---|
86 | fmt << EOF |
---|
87 | |
---|
88 | Please fill in the specified fields of the bug report form, which will |
---|
89 | be displayed momentarily. |
---|
90 | Remember to save the file before exiting the editor. |
---|
91 | EOF |
---|
92 | |
---|
93 | if [ -r "${MH-$HOME/.mh_profile}" ]; then |
---|
94 | PATH="$saved_path" /usr/athena/bin/comp -form "$report_file" |
---|
95 | rm "$report_file" |
---|
96 | exit 0 |
---|
97 | fi |
---|
98 | # not using MH; run the editor, and send, ourselves. |
---|
99 | MH=/dev/null; export MH |
---|
100 | if [ "${EDITOR}" = "" ]; then |
---|
101 | EDITOR=/usr/athena/bin/emacs ; export EDITOR |
---|
102 | fi |
---|
103 | |
---|
104 | PATH="$saved_path" exec whatnow -editor "$EDITOR" "$report_file" |
---|