1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#!/bin/bash
#
# hibernate bug submission control script
#
# allows Debian's bug tools to include relevant information in bug reports.
#
# Copyright © martin f. krafft <madduck@debian.org>
# distributed under the terms of the Artistic Licence 2.0
#
# we need /bin/bash for readline and -n capabalities in the prompt(s)
#
# $Id: bugscript 89 2006-08-08 09:33:05Z madduck $
#
set -eu
if ! command -v yesno >/dev/null; then
if [ -r /usr/share/reportbug/handle_bugscript ]; then
exec /usr/share/reportbug/handle_bugscript ". $0" /dev/stdout
fi
yesno() {
read -n1 -p"$1" REPLY
case "$REPLY" in
[yY]) REPLY=yep;;
[nN]) REPLY=nop;;
('') REPLY="$2";;
esac
}
exec 3>&1
fi
L=$(sed -ne 's,^LogVerbosity[[:space:]]*,,p' /etc/hibernate/*.conf)
case "$L" in
0|1|2)
cat <<-_eof
Your hibernate LogVerbosity is set to $L. If would be of great
help if you could bump that up to 3, rerun hibernate to reproduce
the bug, and then fire up reportbug. You may also wish to set the
verbosity to 4 and submit a URL to your /var/log/hibernate.log in
the bug report. Please do not include the output of a verbosity
4 run in the bug report as it's just too big.
_eof
#yesno "Do you wish to continue filing the bug report at this time? " yep
yesno "Hit any key to continue..." yep
#[ "$REPLY" = yep ] || exit 1
;;
esac
echo "--- configuration" >&3
head -10000 /etc/hibernate/*.conf 2>/dev/null | grep '^[^#]' >&3 || :
echo >&3
echo "--- /sys/power" >&3
head /sys/power/* 2>/dev/null | grep -v '^$' >&3 || :
echo >&3
if [ -x "$(command -v s2ram)" ]; then
echo "--- s2ram -n" >&3
s2ram -n | sed -e '/^See http:/,$d' >&3 || :
fi
yesno "Do you have a URL to your hibernate.log file? " yep
LOG=''
if [ "$REPLY" = yep ]; then
while :; do
read -e -p 'Please enter the http or ftp URL (or "none"): ' rep
case "$rep" in
http://*|ftp://*)
LOG="$rep"
break
;;
none) break;;
*) :;;
esac
done
fi
echo "--- log" >&3
if [ -z "$LOG" ]; then
if [ -r /var/log/hibernate.log ]; then
tac /var/log/hibernate.log | sed -ne '0,/^Starting/p' | tac >&3
else
if [ -f /var/log/hibernate.log ]; then
echo "hibernate.log file not readable." >&3
else
echo "no hibernate.log file found." >&3
fi
fi
else
echo "$LOG" >&3
fi
|