bootdisk: ui-bugreport (NEW) [malekith]

PLD CVS pld-cvs-commit w pld.org.pl
Czw, 25 Lip 2002, 14:50:54 CEST


Module name:	bootdisk	(BRANCH: PLD_1_0)
Changes by:	malekith	02/07/25 14:50:52

Added files:
	ui-bugreport

Log message:
- sync with HEAD

--- NEW FILE: ui-bugreport ---
#!/bin/sh
#
# Copyright (c) 2002 Michal Moskal <malekith w pld-linux.org>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#	This product includes software developed by Michal Moskal.
# 4. Neither the name of the author nor the names of any co-contributors
#    may be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY MICHAL MOSKAL AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: ui-bugreport,v 1.1.2.1 2002/07/25 12:50:51 malekith Exp $
#

SERVER_ADDRESS="192.168.1.1 12345"

export PATH=.:..:$PATH
add_title="_Bug _Report"
. installer-functions
. ui-functions

dial <<EOF
$(nls "This program will let you write and supply bug report to us.")<br>
$(nls "Bug report will be sent to our server, and immediately to")<br>
$(nls "pld-installer w pld.org.pl and to Cc:'ed to address you will")<br>
$(nls "supply.")<br>
<br>
$(nls "Alternatively if you don't have network connection available,")<br>
$(nls "or simply don't want to send it now, you can save the bug")<br>
$(nls "report to diskette and send it later.")<br>
<br>
$(nls "Bug report include all configuration of installer and log files.")<br>
$(nls "pld-installer w pld.org.pl is public mailing list, with archives")<br>
$(nls "available, so if you have some confidential information in")<br>
$(nls "installer config files, consider removing it, before sending")<br>
$(nls "bug report. (You'll be given chance to edit it).")<br>
<br>
$(nls "You can press Ctrl-C at any time to abandon creation of bug report.")
<br>
<br>
                          <button>
EOF

dial <<EOF
$(nls "This bootdisk contains e3 editor, that can emulate few")<br>
$(nls "other editors (to some limited extent of course).")<br>
$(nls "Which emulation would you like to use?")<br><br>
<menu id=editor res=1>
<item id=vi>_Vi
<item id=emacs>_Emacs
<item id=pico>_Pico
<item id=ne>_Ne
<item id=ws>_WordStar
</menu>
EOF

case $editor in
  vi ) 
    exit="<ESC>:q<ENTER>"
    ;;
  emacs )
    exit="Ctrl-X Ctrl-C"
    ;;
  ne )
    exit="Ctrl-Q"
    ;;
  pico )
    exit="Ctrl-X"
    ;;
  ws )
    exit="Ctrl-K X"
    ;;
esac

(
cat <<EOF
BUG: ----------------------------------------------------------------------
BUG: $(nls "Please write your bug report here (i.e. what happened, that you think")
BUG: $(nls "is a bug).")
BUG: $(nls "Lines starting with BUG: are automatically removed from the message.")
BUG: $(nls "In order to leave this editor (you'll be asked if you want to save")
BUG: $(nls "the file) press %s." "$exit")
BUG: ----------------------------------------------------------------------




BUG: $(nls "Don't forget to write your email somewhere here, in case we'll")
BUG: $(nls "have to contact you!")


BUG: ----------------------------------------------------------------------
BUG: $(nls "Below is contest of few configuration files, log files and output")
BUG: $(nls "of few commands. Please check if they doesn't contain confidential")
BUG: $(nls "information. OTOH: this files will probably help us diagnose your")
BUG: $(nls "problem.")
BUG: ----------------------------------------------------------------------
EOF

for f in /etc/installer.conf /etc/installer.sysconf /etc/installer.pkgs \
	 /var/log/installer /var/log/messages ; do
  echo
  echo
  echo
  echo
  echo "================================================================="
  echo "=== $f"
  echo "================================================================="
  
  cat $f

  echo "=== EOF $f"
done

for cmd in dmesg ; do
  echo
  echo
  echo
  echo
  echo "================================================================="
  echo "=== \`$f\`"
  echo "================================================================="
  
  $f

  echo "=== EOF \`$f\`"
done
) > /tmp/bug.txt

cp /tmp/bug.txt /tmp/bug.txt.orig
$editor /tmp/bug.txt

if cmp -s /tmp/bug.txt /tmp/bug.txt.orig ; then
  dial <<EOF
$(nls "You havn't changed the bug report (or didn't save it). Aborting.")
<br><br>
<button>
EOF
  exit 1
fi

net=$(nls "<br>Note: You don't seem to have network configured,<br>so sending bug report is not likely to work.<br>")

if test -x /sbin/ip ; then
  if [ "X$(/sbin/ip r)" != X ] ; then
    net=
  fi
fi

dial <<EOF
$(nls "Now, after you have edited your bug report you can")<br>
$(nls "send it, save it or drop it.")<br>
$net<br>
<menu id=method res=1>
<item id=save>$(nls "_Save it to diskette")
<item id=send>$(nls "_Send it to us!")
<item id=cancel>$(nls "_Abandon")
</menu>
EOF

save () {
    if mount -t vfat /dev/fd0 /mnt ; then
      :
    else
      dial <<EOF
$(nls "Please insert diskette in drive and press")<br>
$(nls "enter when ready.")<br><br>
       <button>
EOF
      if mount -t vfat /dev/fd0 /mnt ; then
        :
      else
        dial <<EOF
$(nls "Cannot mount floppy. Bug report is in %s." /tmp/bug.txt)
<br><br>
         <button>
EOF
	exit 1
      fi
    fi

    cp /tmp/bug.txt /mnt
    umount /mnt
    dial <<EOF
$(nls "Bug report saved to file %s. Please send it to" bug.txt)<br>
$(nls "feedback w pld.org.pl, or directly to pld-installer w pld.org.pl")<br>
$(nls "if you are subscribed there. Thank you!")<br>
<br>
            <button>
EOF
}

send () {
  dial <<EOF
$(nls "Please enter your address here, if you would like")<br>
$(nls "to be sent carbon copy (cc:) of bug report message.")<br>
$(nls "Otherwise leave it blank.")<br><br>
$(nls "Cc:") <input id=cc><br>
<button>
EOF
  if (echo "$cc"; cat /tmp/bug.txt) | gzip | nc $SERVER_ADDRESS ; then
    dial <<EOF
$(nls "Message sent. Thank you!")<br>
     <button>
EOF
  else
    if yes_no yes "$(nls "I was unable to send this bug report.<br>Would you like to save it to diskette<br>to send it later?")" ; then
      save
    fi
  fi
}

case $method in
  save )
    save
    ;;
    
  send )
    send
    ;;
esac



Więcej informacji o liście dyskusyjnej pld-installer