1 | #!/bin/sh -e
|
---|
2 | #
|
---|
3 | # Script for reporting bugs to Debian BTS for the mondo package
|
---|
4 | #
|
---|
5 |
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Configuration
|
---|
9 | #
|
---|
10 | MINDI_LOG="/var/log/mindi.log"
|
---|
11 | MONDO_LOG="/var/log/mondo-archive.log"
|
---|
12 | MAXSIZE=10485760
|
---|
13 |
|
---|
14 |
|
---|
15 | #
|
---|
16 | # Include a log file
|
---|
17 | #
|
---|
18 | IncludeLog() {
|
---|
19 | if [ -e "$1" ] ; then
|
---|
20 | printf "\nContents of $1:\n\n" >&3
|
---|
21 | if [ `stat -c "%s" $1` -le $MAXSIZE ]; then
|
---|
22 | cat "$1" >&3
|
---|
23 | else
|
---|
24 | echo "WARNING:"
|
---|
25 | echo "$1 exists but is larger than $MAXSIZE. Therefore"
|
---|
26 | echo "I will not include it."
|
---|
27 | echo "If you would like to attach it as described above you should terminate"
|
---|
28 | echo "this report without sending it and create a new one with the attachemnt."
|
---|
29 | echo "This is strongly recommended."
|
---|
30 | echo
|
---|
31 | printf "$1 not included because it is larger than $MAXSIZE bytes.\n" >&3
|
---|
32 | fi
|
---|
33 | else
|
---|
34 | printf "$MINDI_LOG does not exist.\n" >&3
|
---|
35 | fi
|
---|
36 | printf "\n=========================================================\n" >&3
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
40 | #
|
---|
41 | # Dialog for log files
|
---|
42 | #
|
---|
43 | clear
|
---|
44 | echo "Package-specific Questions"
|
---|
45 | echo
|
---|
46 | echo "It is strongly suggested that you include log files $MINDI_LOG"
|
---|
47 | echo "and $MONDO_LOG in your bug report. Due to their size,"
|
---|
48 | echo "the best way to do this is to put them in a gzipped tar ball and attach"
|
---|
49 | echo "this to the report. Alternatively, I can include the files in the report"
|
---|
50 | echo "as text provided each is smaller than $MAXSIZE bytes."
|
---|
51 | echo
|
---|
52 |
|
---|
53 | yesno "Have you attached the above logs? [y,N]" "nop"
|
---|
54 | if [ "$REPLY" = "yep" ]; then
|
---|
55 | printf "$MINDI_LOG and $MONDO_LOG provided in attachment.\n" >&3
|
---|
56 | else
|
---|
57 | yesno "May I include the above logs in the bug report? [Y,n]" "yep"
|
---|
58 | if [ "$REPLY" = "yep" ]; then
|
---|
59 | IncludeLog $MINDI_LOG
|
---|
60 | IncludeLog $MONDO_LOG
|
---|
61 | else
|
---|
62 | echo "You have chosen not to include the above logs. This will most likely"
|
---|
63 | echo "make it much harder to help you."
|
---|
64 | echo
|
---|
65 | printf "$MINDI_LOG and $MONDO_LOG not included as per user request.\n" >&3
|
---|
66 | fi
|
---|
67 | fi
|
---|
68 |
|
---|
69 |
|
---|
70 | #
|
---|
71 | # Dialog for file system info
|
---|
72 | #
|
---|
73 | printf "\n\n" >&3
|
---|
74 | printf "=========================================================\n" >&3
|
---|
75 | echo "One cause of failure for mondo is that it runs out of diskspace."
|
---|
76 | echo "I can include information about the fill state of your mounted filesystems."
|
---|
77 | echo
|
---|
78 | yesno "May I include information about the fill state of your mounted filesystems? [Y,n]" "yep"
|
---|
79 | if [ "$REPLY" = "yep" ]; then
|
---|
80 | printf "Fileystem information:\n" >&3
|
---|
81 | df >&3
|
---|
82 | else
|
---|
83 | printf "Fileystem information not included as per user request.\n" >&3
|
---|
84 | fi
|
---|
85 |
|
---|
86 |
|
---|
87 | #
|
---|
88 | # End
|
---|
89 | #
|
---|
90 | exit 0
|
---|