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

Revision 9906, 2.7 KB checked in by ghudson, 27 years ago (diff)
Improve the awk code for reading /etc/athena/version, making it more readable and producing possibly more meaningful results. (Worth noting: the existing update scripts can't ever produce actual updates to the same version, so maybe the original intent was to count the number of times mkserv was run. In that case, further tweaking is in order.)
Line 
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
5saved_path="$PATH"
6
7# make sure stuff this script needs is up front
8PATH=/srvd/patch:/usr/athena/bin:/bin/athena:/usr/bin/X11:/usr/ucb:/bin:/usr/bin:/usr/bsd:/usr/sbin
9export PATH
10
11bugs_address=bugs@MIT.EDU
12sendmail="/usr/lib/sendmail -t -oi"
13report_file=/tmp/bug$$.text
14version_file=/etc/athena/version
15if [ ! -r "$version_file" ]; then
16        version="unknown version (no $version_file found)"
17else
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"`
51fi
52short_version=`expr "$version (" : '\([^(]*[^( ]\) *(.*'`
53machtype=`machtype`
54cpu=`machtype -c`
55hostname=`hostname`
56dpy=`machtype -d`
57fmt << EOF
58Please enter the name of the program or locker with which you are
59having problems. You may first want to check with the consultants to
60see if there is a known workaround to this problem; hit ctrl-c now and
61type 'olc' at your athena% prompt to enter a question.
62EOF
63echo -n ' --> '
64read subject
65cat > $report_file << EOF
66To: $bugs_address
67Subject: $machtype $short_version: $subject
68-------
69System name:            $hostname
70Type and version:       $cpu $version
71Display type:           $dpy
72
73What were you trying to do?
74        [Please replace this line with your information.]
75
76What's wrong:
77        [Please replace this line with your information.]
78
79What should have happened:
80        [Please replace this line with your information.]
81
82Please describe any relevant documentation references:
83        [Please replace this line with your information.]
84EOF
85
86fmt << EOF
87
88Please fill in the specified fields of the bug report form, which will
89be displayed momentarily.
90Remember to save the file before exiting the editor.
91EOF
92
93if [ -r "${MH-$HOME/.mh_profile}" ]; then
94        PATH="$saved_path" /usr/athena/bin/comp -form "$report_file"
95        rm "$report_file"
96        exit 0
97fi
98# not using MH; run the editor, and send, ourselves.
99MH=/dev/null; export MH
100if [ "${EDITOR}" = "" ]; then
101        EDITOR=/usr/athena/bin/emacs ; export EDITOR
102fi
103
104PATH="$saved_path" exec whatnow -editor "$EDITOR" "$report_file"
Note: See TracBrowser for help on using the repository browser.