/usr/bin/fwts-collect is in fwts 0.24.21.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | #!/bin/bash
#
# Copyright (C) 2012 Canonical
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
OUTNAME=fwts-logs.tar.gz
TMPDIR=/tmp/fwts.$$
FWTS=`which fwts`
#
# sighandler
#
on_die()
{
if [ -d $TMPDIR ]; then
rm -rf $TMPDIR
echo "Interrupted, exiting."
exit 1
fi
}
#
# Show how to use this script
#
show_help()
{
cat << EOD
fwts-collect [ LOGFILEs... ]
Collect up fwts related logs and put them in a gzip'd tar file
for appending to bug reports. By default this will collect the
basic logs and system related information, but one can also
specify extra files to add to the archive too.
example:
fwts-collect report.log /var/log/messages
EOD
}
#
# Dump out ACPI interrupt stats
#
acpi_irq_dump()
{
if [ -d /sys/firmware/acpi/interrupts ]; then
echo "/sys/firmware/acpi/interrupts:"
echo " "
for I in /sys/firmware/acpi/interrupts/*
do
name=`basename $I`
echo -e "$name\t" `cat $I`
done
fi
}
while getopts "o:h" opt;
do
case $opt in
h) show_help
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" 1>&2
exit 1
;;
esac
done
OUTFILE=`basename $OUTNAME`
OUTPATH=$PWD
OUTNAME=$OUTPATH/$OUTFILE
#
# Sanity checks
#
if [ -d $OUTNAME ] ; then
echo "$OUTNAME is a directory and already exists." 1>&2
exit 1
fi
if [ -e $OUTNAME ] ; then
echo "File $OUTFILE already exists." 1>&2
exit 1
fi
if [[ $EUID -ne 0 ]]; then
echo "Need to run this as root" 1>&2
exit 1
fi
if [ -z $FWTS ]; then
echo "Firmware test suite fwts does not exist!" 1>&2
exit 1
fi
if [ -d $TMPDIR ]; then
echo "Cannot create temporary directory $TMPDIR: already exists!" 1>&2
exit 1
fi
trap 'on_die' TERM INT
mkdir $TMPDIR
err=$?
if [ $err -ne 0 ]; then
echo "Cannot create temporary directory $TMPDIR: error $err" 1>&2
exit 1
fi
#
# Dump out logs
#
cd $TMPDIR
#
# General /proc info
#
cat /proc/iomem > iomem.log
cat /proc/mtrr > mtrr.log
cat /proc/interrupts > interrupts.log
acpi_irq_dump > acpi_irqs.log
#
# Copy of kernel log
#
cp /var/log/kern.log kern.log
#
# fwts specific output
#
fwts --dump >& /dev/null
fwts cmosdump --log-format="" -r cmosdump.log >& /dev/null
fwts ebdadump --log-format="" -r ebdadump.log >& /dev/null
fwts uefidump --log-format="" -r uefidump.log >& /dev/null
fwts memmapdump --log-format="" -r memmap.log >& /dev/null
fwts acpidump --log-format="" -r acpitables.log >& /dev/null
fwts mpdump --log-format="" -r mpdump.log >& /dev/null
fwts version --log-format="" -r version.log >& /dev/null
#
# Copy over any extra user specified logs
#
cd $OUTPATH
while [ $# -ne 0 ]
do
if [ -e $1 ]; then
cp $1 $TMPDIR
else
echo "File $1 does not exist!" 1>& 2
rm -rf $TMPDIR
exit 1
fi
shift
done
#
# Now archive up the files
#
cd $TMPDIR
tar cfz - . > $OUTNAME
cd $OUTPATH
rm -rf $TMPDIR
exit 0
|