[5] | 1 | #!/bin/sh |
---|
[9906] | 2 | # $Id: sendbug.sh,v 1.17 1997-04-30 08:32:56 ghudson Exp $ |
---|
[8670] | 3 | |
---|
| 4 | # save PATH so we can restore it for user's $EDITOR later |
---|
| 5 | saved_path="$PATH" |
---|
| 6 | |
---|
[2433] | 7 | # make sure stuff this script needs is up front |
---|
[7803] | 8 | PATH=/srvd/patch:/usr/athena/bin:/bin/athena:/usr/bin/X11:/usr/ucb:/bin:/usr/bin:/usr/bsd:/usr/sbin |
---|
[8670] | 9 | export PATH |
---|
| 10 | |
---|
[6925] | 11 | bugs_address=bugs@MIT.EDU |
---|
[2433] | 12 | sendmail="/usr/lib/sendmail -t -oi" |
---|
| 13 | report_file=/tmp/bug$$.text |
---|
[9906] | 14 | version_file=/etc/athena/version |
---|
| 15 | if [ ! -r "$version_file" ]; then |
---|
[2433] | 16 | version="unknown version (no $version_file found)" |
---|
| 17 | else |
---|
[9906] | 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"` |
---|
[2433] | 51 | fi |
---|
| 52 | short_version=`expr "$version (" : '\([^(]*[^( ]\) *(.*'` |
---|
| 53 | machtype=`machtype` |
---|
| 54 | cpu=`machtype -c` |
---|
| 55 | hostname=`hostname` |
---|
| 56 | dpy=`machtype -d` |
---|
[5386] | 57 | fmt << EOF |
---|
[7801] | 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. |
---|
[2433] | 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 |
---|
[2447] | 72 | |
---|
[2433] | 73 | What were you trying to do? |
---|
[2447] | 74 | [Please replace this line with your information.] |
---|
[5] | 75 | |
---|
[2433] | 76 | What's wrong: |
---|
[2447] | 77 | [Please replace this line with your information.] |
---|
[2433] | 78 | |
---|
| 79 | What should have happened: |
---|
[2447] | 80 | [Please replace this line with your information.] |
---|
[2433] | 81 | |
---|
| 82 | Please describe any relevant documentation references: |
---|
[2447] | 83 | [Please replace this line with your information.] |
---|
[2433] | 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 | |
---|
[8670] | 93 | if [ -r "${MH-$HOME/.mh_profile}" ]; then |
---|
[8764] | 94 | PATH="$saved_path" /usr/athena/bin/comp -form "$report_file" |
---|
[8670] | 95 | rm "$report_file" |
---|
[2433] | 96 | exit 0 |
---|
| 97 | fi |
---|
| 98 | # not using MH; run the editor, and send, ourselves. |
---|
[5966] | 99 | MH=/dev/null; export MH |
---|
[5386] | 100 | if [ "${EDITOR}" = "" ]; then |
---|
[8764] | 101 | EDITOR=/usr/athena/bin/emacs ; export EDITOR |
---|
[2433] | 102 | fi |
---|
| 103 | |
---|
[8764] | 104 | PATH="$saved_path" exec whatnow -editor "$EDITOR" "$report_file" |
---|