From Fedora Project Wiki

I made a bash script that attempts to gather together a collection of information that developers regularly request from a bugzilla poster:

bugzilla-information-gatherer.sh:


#! /bin/bash


Command=$1
InfoDir=~/bugzilla-information
LogFile=$InfoDir/bugzilla-information-gatherer.log
UserName=<code>whoami</code>

if ! [ -d $InfoDir ] ; then
echo "  creating a folder to store the info and logs"
mkdir $InfoDir
fi

cd $InfoDir

echo "bugzilla-information-gatherer.sh" >$LogFile
echo "  linux distribution release:" >>$LogFile
cat /etc/fedora-release >>$LogFile

echo "  installed kernel packages:" >>$LogFile
rpm -qa kernel\*|sort >>$LogFile

echo "  command that has an issue:" >>$LogFile
echo $Command >>$LogFile

echo "  where is the command located" >>$LogFile
CommandLocation=<code>which $Command</code> >>$LogFile
echo $CommandLocation >>$LogFile

echo "  from what package:" >>$LogFile
CommandPackage=<code>rpm -qf $CommandLocation</code>
echo $CommandPackage >>$LogFile

echo "  verify that package:" >>$LogFile
rpm -V $CommandPackage >>$LogFile

echo "  running kernel:" >>$LogFile
uname -a >>$LogFile

echo "  loaded modules:" >>$LogFile
/sbin/lsmod|sort >lsmod-sort.txt

echo "  lspci:" >>$LogFile
/sbin/lspci >lspci.txt

echo "  lspci -n:" >>$LogFile
/sbin/lspci -n >lspci-n.txt

echo "  lspci -vv:" >>$LogFile
echo ""
echo "  To retrieve detailed lspci information, please enter the root password"
echo $UserName
su -c '/sbin/lspci -vv >lspci-vv.txt && chown '$UserName' lspci-vv.txt'

echo "  lspci combine:" >>$LogFile
cat lspci*.txt >lspci.detail.log

echo "  dmidecode:" >>$LogFile
echo ""
echo "  To retrieve detailed dmidecode information, please enter the root password"
su -c '/usr/sbin/dmidecode >dmidecode.txt && chown '$UserName' dmidecode.txt'

echo "  lsusb:" >>$LogFile
echo ""
echo "  To retrieve detailed lsusb information, please enter the root password"
su -c '/sbin/lsusb -v >lsusb-v.txt && chown '$UserName' lsusb-v.txt'
/sbin/lsusb >lsusb.txt

echo "  $Command - starting" >>$LogFile
echo "  -$Command-"
$Command >>$LogFile
echo "  $Command - finished" >>$LogFile

echo "  view results log and specific info txt" >>$LogFile
ls -1|xargs gedit &