[Linux-Biella] oops reporter script
Paolo Ciarrocchi
paolo.ciarrocchi a gmail.com
Gio 23 Giu 2005 10:36:16 CEST
Ciao a tutti,
qualche giorno fa ho postato su lkml un'idea su come automatizzare il
processo di invio di BUG report relativi ai kernel vanilla.
Il mio suggerimento e' stato raccolto e Michael Piotrowski mi ha
contattato per fare la review di un suo lavoro molto simila a quanto
avevo suggerito ma piu' completo.
Il risultato del suo lavoro, e di un paio di miei patch e' il seguente:
#! /bin/bash
# Copyright (C) 2005 Micha³ Piotrowski <piotrowskim a trex.wsi.edu.pl>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ORT_F=ort_oops-`date +%x`.txt
VER=v.a6
help() {
echo "Usage: [root a ng02 ort]$ ./ort.sh oops.txt"
echo "\nYou need to be root to run the script"
exit 1
}
if [[ -z "$1" || "$1" = "--help" ]]
then
help
elif [[ ! -f "$1" ]]
then
echo "ERROR: You must give proper file with Oops"
help
exit 1
fi
clear
echo "OOPS Reporting Tool $VER"
echo "OOPS Reporting Tool $VER" > $ORT_F
echo "[1.] One line summary of the problem: (press Return when done)"
echo -e "\n[1.] One line summary of the problem:" >> $ORT_F
read TXT
echo "$TXT" >> $ORT_F
echo "[2.] Full description of the problem/report: (press Return when done)"
echo -e "\n[2.] Full description of the problem/report:" >> $ORT_F
read TXT
echo "$TXT" >> $ORT_F
echo "[3.] Keywords (i.e., modules, networking, kernel): (press Return
when done)"
echo -e "\n[3.] Keywords (i.e., modules, networking, kernel):" >> $ORT_F
read TXT
echo "$TXT" >> $ORT_F
echo -e "\n[4.] Kernel version (from /proc/version):" >> $ORT_F
cat /proc/version >> $ORT_F
echo -e "\n[5.] Output of Oops" >> $ORT_F
cat $1 >> $ORT_F
echo -e "\n[7.] Environment" >> $ORT_F
echo -e "\n[7.1.] Software" >> $ORT_F
/lib/modules/`uname -r`/build/scripts/ver_linux >> $ORT_F
echo -e "\n[7.2.] Processor information" >> $ORT_F
cat /proc/cpuinfo >> $ORT_F
echo -e "\n[7.3.] Module information" >> $ORT_F
cat /proc/modules >> $ORT_F
echo -e "\n[7.4.] Loaded driver and hardware information" >> $ORT_F
cat /proc/ioports >> $ORT_F
cat /proc/iomem >> $ORT_F
echo -e "\n[7.5.] PCI information" >> $ORT_F
lspci -vvv >> $ORT_F
if [ -f /proc/scsi/scsi ]; then
echo -e "\n[7.6.] SCSI information" >> $ORT_F
cat /proc/scsi/scsi >> $ORT_F
fi
echo -e "\n[7.7.] USB information" >> $ORT_F
lsusb -v >> $ORT_F
echo -e "\n[7.8.] Dmesg log" >> $ORT_F
dmesg -s 100000 >> $ORT_F
echo -e "\n[8.] Config file"
echo -e "\n[8.] Config file" >> $ORT_F
END=0
while [ $END = 0 ]
do
echo -e "\nDo You want to pass the path to kernel .config file?"
echo -e "[A(utomagic)/Y(es)/S(kip)]"
read TXT
if [ $TXT = "Y" ] || [ $TXT = "y" ]
then
echo "Enter path: (eg. /usr/src/linux-2.6)"
read TXT
if [ -f $TXT/.config ]
then
cat $TXT/.config >> $ORT_F
END=1
else
echo "ERROR: Wrong path"
fi
elif [ $TXT = "A" ] || [ $TXT = "a" ]
then
if [ -f /proc/config.gz ];
then
gzip -cd /proc/config.gz >> $ORT_F
else
cat /lib/modules/`uname -r`/build/.config >> $ORT_F
fi
END=1
elif [ $TXT = "S" ] || [ $TXT = "s" ]
then
END=1
fi
done
END=0
while [ $END = 0 ]
do
echo -e "\nDo You want to see $ORT_F?"
echo -e "[Y(es)/N(o)]"
read TXT
if [ $TXT = "Y" ] || [ $TXT = "y" ]
then
less $ORT_F
END=1
elif [ $TXT = "N" ] || [ $TXT = "n" ]
then
END=1
fi
done
END=0
while [ $END = 0 ]
do
echo -e "\nDo You want to edit $ORT_F in vim?"
echo -e "[Y(es)/N(o)]"
read TXT
if [ $TXT = "Y" ] || [ $TXT = "y" ]
then
vim $ORT_F
END=1
elif [ $TXT = "N" ] || [ $TXT = "n" ]
then
END=1
fi
done
Ora, quello che dovremmo ancora fare e':
2. Item 2 (full description) should allow for more than one line
of input.
3. Item 3 (keywords) probably should allow for more than one line
of input.
4. Item 4 (kernel version) and all of 7 (Environment) assume that
the oops happened on the system where the oops report is being
produced. That's probably correct lots of the time, but not always.
But I don't know what to do about it.
5. Item 7 (small sample program to duplicate problem): at least put
an empty reminder at this spot, this is a Very Important Program.
6. Use $EDITOR instead of vim if it is defined (set).
Se qualcuno vuole collaborare... patch e commenti sono piu' che benvenuti.
--
Paolo
Maggiori informazioni sulla lista
Linux