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

Revision 13428, 2.9 KB checked in by danw, 25 years ago (diff)
only grab the shell once, regardless of how many times the user is in the passwd file
Line 
1#!/bin/sh
2# $Id: sendbug.sh,v 1.19 1999-07-28 00:37:37 danw 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`
57
58shell=`awk -F: '/^'$USER':/ { print $7; exit; }' /etc/passwd 2>/dev/null`
59case $shell in
60$SHELL)
61    ;;
62"")
63    shell="$SHELL (?)"
64    ;;
65*)
66    shell="$shell ($SHELL?)"
67    ;;
68esac
69
70fmt << EOF
71Please enter the name of the program or locker with which you are
72having problems. You may first want to check with the consultants to
73see if there is a known workaround to this problem; hit ctrl-c now and
74type 'olc' at your athena% prompt to enter a question.
75EOF
76echo -n ' --> '
77read subject
78cat > $report_file << EOF
79To: $bugs_address
80Subject: $machtype $short_version: $subject
81-------
82System name:            $hostname
83Type and version:       $cpu $version
84Display type:           $dpy
85
86Shell:                  $shell
87Window manager:         ${WINDOW_MANAGER:-unknown}
88
89What were you trying to do?
90        [Please replace this line with your information.]
91
92What's wrong:
93        [Please replace this line with your information.]
94
95What should have happened:
96        [Please replace this line with your information.]
97
98Please describe any relevant documentation references:
99        [Please replace this line with your information.]
100EOF
101
102fmt << EOF
103
104Please fill in the specified fields of the bug report form, which will
105be displayed momentarily.
106Remember to save the file before exiting the editor.
107EOF
108
109if [ -r "${MH-$HOME/.mh_profile}" ]; then
110        PATH="$saved_path" /usr/athena/bin/comp -form "$report_file"
111        rm "$report_file"
112        exit 0
113fi
114# not using MH; run the editor, and send, ourselves.
115MH=/dev/null; export MH
116if [ "${EDITOR}" = "" ]; then
117        EDITOR=/usr/athena/bin/emacs ; export EDITOR
118fi
119
120PATH="$saved_path" exec whatnow -editor "$EDITOR" "$report_file"
Note: See TracBrowser for help on using the repository browser.