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