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

Revision 8764, 2.5 KB checked in by ghudson, 28 years ago (diff)
Always restore user's path before running comp or whatis.
Line 
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
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
14if [ ! -r /etc/athena/version -a -r /etc/version ]; then
15      version_file=/etc/version
16else
17      version_file=/etc/athena/version
18fi
19if [ ! -r $version_file ]; then
20        version="unknown version (no $version_file found)"
21else
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`
37fi
38short_version=`expr "$version (" : '\([^(]*[^( ]\) *(.*'`
39machtype=`machtype`
40cpu=`machtype -c`
41hostname=`hostname`
42dpy=`machtype -d`
43fmt << EOF
44Please enter the name of the program or locker with which you are
45having problems. You may first want to check with the consultants to
46see if there is a known workaround to this problem; hit ctrl-c now and
47type 'olc' at your athena% prompt to enter a question.
48EOF
49echo -n ' --> '
50read subject
51cat > $report_file << EOF
52To: $bugs_address
53Subject: $machtype $short_version: $subject
54-------
55System name:            $hostname
56Type and version:       $cpu $version
57Display type:           $dpy
58
59What were you trying to do?
60        [Please replace this line with your information.]
61
62What's wrong:
63        [Please replace this line with your information.]
64
65What should have happened:
66        [Please replace this line with your information.]
67
68Please describe any relevant documentation references:
69        [Please replace this line with your information.]
70EOF
71
72fmt << EOF
73
74Please fill in the specified fields of the bug report form, which will
75be displayed momentarily.
76Remember to save the file before exiting the editor.
77EOF
78
79if [ -r "${MH-$HOME/.mh_profile}" ]; then
80        PATH="$saved_path" /usr/athena/bin/comp -form "$report_file"
81        rm "$report_file"
82        exit 0
83fi
84# not using MH; run the editor, and send, ourselves.
85MH=/dev/null; export MH
86if [ "${EDITOR}" = "" ]; then
87        EDITOR=/usr/athena/bin/emacs ; export EDITOR
88fi
89
90PATH="$saved_path" exec whatnow -editor "$EDITOR" "$report_file"
Note: See TracBrowser for help on using the repository browser.