#!/bin/sh -e # # Script for reporting bugs to Debian BTS for the mondo package # # # Configuration # MINDI_LOG="/var/log/mindi.log" MONDO_LOG="/var/log/mondo-archive.log" MAXSIZE=10485760 # # Include a log file # IncludeLog() { if [ -e "$1" ] ; then printf "\nContents of $1:\n\n" >&3 if [ `stat -c "%s" $1` -le $MAXSIZE ]; then cat "$1" >&3 else echo "WARNING:" echo "$1 exists but is larger than $MAXSIZE. Therefore" echo "I will not include it." echo "If you would like to attach it as described above you should terminate" echo "this report without sending it and create a new one with the attachemnt." echo "This is strongly recommended." echo printf "$1 not included because it is larger than $MAXSIZE bytes.\n" >&3 fi else printf "$MINDI_LOG does not exist.\n" >&3 fi printf "\n=========================================================\n" >&3 } # # Dialog for log files # clear echo "Package-specific Questions" echo echo "It is strongly suggested that you include log files $MINDI_LOG" echo "and $MONDO_LOG in your bug report. Due to their size," echo "the best way to do this is to put them in a gzipped tar ball and attach" echo "this to the report. Alternatively, I can include the files in the report" echo "as text provided each is smaller than $MAXSIZE bytes." echo yesno "Have you attached the above logs? [y,N]" "nop" if [ "$REPLY" = "yep" ]; then printf "$MINDI_LOG and $MONDO_LOG provided in attachment.\n" >&3 else yesno "May I include the above logs in the bug report? [Y,n]" "yep" if [ "$REPLY" = "yep" ]; then IncludeLog $MINDI_LOG IncludeLog $MONDO_LOG else echo "You have chosen not to include the above logs. This will most likely" echo "make it much harder to help you." echo printf "$MINDI_LOG and $MONDO_LOG not included as per user request.\n" >&3 fi fi # # Dialog for file system info # printf "\n\n" >&3 printf "=========================================================\n" >&3 echo "One cause of failure for mondo is that it runs out of diskspace." echo "I can include information about the fill state of your mounted filesystems." echo yesno "May I include information about the fill state of your mounted filesystems? [Y,n]" "yep" if [ "$REPLY" = "yep" ]; then printf "Fileystem information:\n" >&3 df >&3 else printf "Fileystem information not included as per user request.\n" >&3 fi # # End # exit 0