mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
(package maintainers, no worries on this one, it's just debugging tools)
Updated the debugging data collector to not exit on error of xiin, and also added some debugger outputs.
This commit is contained in:
parent
6168b32895
commit
e9e81c3ef5
145
inxi
145
inxi
|
@ -1074,15 +1074,6 @@ error_handler()
|
|||
16)
|
||||
error_message="$SCRIPT_NAME downloaded but the file data is corrupted. Purged data and using current version."
|
||||
;;
|
||||
17)
|
||||
error_message="Failed to download required file: $2\nMaybe the remote site is down or your networking is broken?"
|
||||
;;
|
||||
18)
|
||||
error_message="$2 downloaded but the file data is corrupted. Unable to continue."
|
||||
;;
|
||||
19)
|
||||
error_message="$2 downloaded but reports error on execution. Unable to continue."
|
||||
;;
|
||||
20)
|
||||
error_message="The option you selected has been deprecated. $2\nSee the -h (help) menu for currently supported options."
|
||||
;;
|
||||
|
@ -1248,8 +1239,8 @@ script_self_updater()
|
|||
# args: $1 - debug data type: sys|xorg|disk
|
||||
debug_data_collector()
|
||||
{
|
||||
local xiin_app='' xiin_data_file='' xiin_download='' inxi_args=''
|
||||
local xiin_data_dir="inxi-$(tr ' ' '-' <<< $HOSTNAME | tr '[A-Z]' '[a-z]' )-$1-$(date +%Y%m%d)"
|
||||
local xiin_app='' xiin_data_file='' xiin_download='' inxi_args='' error=''
|
||||
local debug_data_dir="inxi-$(tr ' ' '-' <<< $HOSTNAME | tr '[A-Z]' '[a-z]' )-$1-$(date +%Y%m%d)"
|
||||
|
||||
if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
|
||||
echo "Starting debugging data collection type: $1"
|
||||
|
@ -1259,39 +1250,42 @@ debug_data_collector()
|
|||
fi
|
||||
echo 'completed'
|
||||
cd $SCRIPT_DATA_DIR
|
||||
if [[ -d $xiin_data_dir ]];then
|
||||
if [[ -d $debug_data_dir ]];then
|
||||
echo 'Deleting previous xiin data directory...'
|
||||
rm -rf $xiin_data_dir
|
||||
rm -rf $debug_data_dir
|
||||
fi
|
||||
mkdir $xiin_data_dir
|
||||
if [[ -f $xiin_data_dir.tar.gz ]];then
|
||||
mkdir $debug_data_dir
|
||||
if [[ -f $debug_data_dir.tar.gz ]];then
|
||||
echo 'Deleting previous tar.gz file...'
|
||||
rm -f $xiin_data_dir.tar.gz
|
||||
rm -f $debug_data_dir.tar.gz
|
||||
fi
|
||||
|
||||
echo 'Collecting system info: sensors, lsusb, lspci, lspci -v data, plus /proc data'
|
||||
lsusb &> $xiin_data_dir/lsusb.txt
|
||||
lspci &> $xiin_data_dir/lspci.txt
|
||||
lspci -v &> $xiin_data_dir/lspci-v.txt
|
||||
sensors &> $xiin_data_dir/sensors.txt
|
||||
cat $FILE_LSB_RELEASE &> $xiin_data_dir/lsb-release.txt
|
||||
cat $FILE_ASOUND_DEVICE &> $xiin_data_dir/proc-asound-device.txt
|
||||
cat $FILE_ASOUND_VERSION &> $xiin_data_dir/proc-asound-version.txt
|
||||
cat $FILE_CPUINFO &> $xiin_data_dir/proc-cpu-info.txt
|
||||
cat $FILE_MEMINFO &> $xiin_data_dir/proc-meminfo.txt
|
||||
cat $FILE_MODULES &> $xiin_data_dir/proc-modules.txt
|
||||
check_recommends &> $xiin_data_dir/check-recommends.txt
|
||||
lsusb &> $debug_data_dir/lsusb.txt
|
||||
lspci &> $debug_data_dir/lspci.txt
|
||||
lspci -v &> $debug_data_dir/lspci-v.txt
|
||||
ps aux &> $debug_data_dir/ps-aux.txt
|
||||
sensors &> $debug_data_dir/sensors.txt
|
||||
cat $FILE_LSB_RELEASE &> $debug_data_dir/lsb-release.txt
|
||||
cat $FILE_ASOUND_DEVICE &> $debug_data_dir/proc-asound-device.txt
|
||||
cat $FILE_ASOUND_VERSION &> $debug_data_dir/proc-asound-version.txt
|
||||
cat $FILE_CPUINFO &> $debug_data_dir/proc-cpu-info.txt
|
||||
cat $FILE_MEMINFO &> $debug_data_dir/proc-meminfo.txt
|
||||
cat $FILE_MODULES &> $debug_data_dir/proc-modules.txt
|
||||
check_recommends &> $debug_data_dir/check-recommends.txt
|
||||
# note, only bash 4> supports ;;& for case, so using if/then here
|
||||
if [[ $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
|
||||
xiin_data_file=$SCRIPT_DATA_DIR/$xiin_data_dir/xiin-sys.txt
|
||||
xiin_data_file=$SCRIPT_DATA_DIR/$debug_data_dir/xiin-sys.txt
|
||||
echo 'Collecting networking data...'
|
||||
ifconfig &> $xiin_data_dir/ifconfig.txt
|
||||
ifconfig &> $debug_data_dir/ifconfig.txt
|
||||
echo 'Downloading required tree traverse tool xiin...'
|
||||
# -Nc is creating really weird download anomolies, so using -O instead
|
||||
xiin_download="$( wget -q -O - http://inxi.googlecode.com/svn/branches/xiin/xiin )"
|
||||
# if nothing got downloaded kick out error, otherwise we'll use an older version
|
||||
if [[ $? -gt 0 && ! -f xiin ]];then
|
||||
error_handler 17 'xiin'
|
||||
echo -e "ERROR: Failed to download required file: xiin\nMaybe the remote site is down or your networking is broken?"
|
||||
echo "Continuing with incomplete data collection."
|
||||
echo 'xiin download failed and no existing xiin' >> $debug_data_dir/xiin-error.txt
|
||||
elif [[ -n $( grep -s 'checkPython' <<< "$xiin_download" ) || -f xiin ]];then
|
||||
if [[ -n $( grep -s 'checkPython' <<< "$xiin_download" ) ]];then
|
||||
echo 'Updating xiin from remote location'
|
||||
|
@ -1301,89 +1295,94 @@ debug_data_collector()
|
|||
fi
|
||||
echo 'Running xiin tool now on /sys...'
|
||||
python ./xiin -d /sys -f $xiin_data_file
|
||||
|
||||
if [[ $? -ne 0 ]];then
|
||||
echo "xiin exited with error $? - removing data file before exiting."
|
||||
error=$?
|
||||
echo -e "ERROR: xiin exited with error $error - removing data file.\nContinuing with incomplete data collection."
|
||||
echo "Continuing with incomplete data collection."
|
||||
rm -f $xiin_data_file
|
||||
error_handler 19 'xiin'
|
||||
echo "xiin data generation failed with python error $error" >> $debug_data_dir/xiin-error.txt
|
||||
fi
|
||||
else
|
||||
error_handler 18 'xiin'
|
||||
echo -e "ERROR: xiin downloaded but the program file data is corrupted.\nContinuing with incomplete data collection."
|
||||
echo "xiin downloaded but the program file data is corrupted." >> $debug_data_dir/xiin-error.txt
|
||||
fi
|
||||
fi
|
||||
if [[ $1 == 'xorg' || $1 == 'all' ]];then
|
||||
if [[ $B_RUNNING_IN_X != 'true' ]];then
|
||||
echo 'Warning: only some of the data collection can occur if you are not in X'
|
||||
touch $xiin_data_dir/warning-user-not-in-x
|
||||
touch $debug_data_dir/warning-user-not-in-x
|
||||
fi
|
||||
if [[ $B_ROOT == 'true' ]];then
|
||||
echo 'Warning: only some of the data collection can occur if you are running as Root user'
|
||||
touch $xiin_data_dir/warning-root-user
|
||||
touch $debug_data_dir/warning-root-user
|
||||
fi
|
||||
echo 'Collecting Xorg log and xorg.conf files'
|
||||
if [[ -e $FILE_XORG_LOG ]];then
|
||||
cat $FILE_XORG_LOG &> $xiin_data_dir/xorg-log-file.txt
|
||||
cat $FILE_XORG_LOG &> $debug_data_dir/xorg-log-file.txt
|
||||
else
|
||||
touch $xiin_data_dir/no-xorg-log-file
|
||||
touch $debug_data_dir/no-xorg-log-file
|
||||
fi
|
||||
if [[ -e /etc/X11/xorg.conf ]];then
|
||||
cp /etc/X11/xorg.conf $xiin_data_dir
|
||||
cp /etc/X11/xorg.conf $debug_data_dir
|
||||
else
|
||||
touch $xiin_data_dir/no-xorg-conf-file
|
||||
touch $debug_data_dir/no-xorg-conf-file
|
||||
fi
|
||||
if [[ -n $( ls /etc/X11/xorg.conf.d/ 2>/dev/null ) ]];then
|
||||
ls /etc/X11/xorg.conf.d &> $xiin_data_dir/ls-etc-x11-xorg-conf-d.txt
|
||||
cp /etc/X11/xorg.conf.d $xiin_data_dir
|
||||
ls /etc/X11/xorg.conf.d &> $debug_data_dir/ls-etc-x11-xorg-conf-d.txt
|
||||
cp /etc/X11/xorg.conf.d $debug_data_dir
|
||||
else
|
||||
touch $xiin_data_dir/no-xorg-conf-d-files
|
||||
touch $debug_data_dir/no-xorg-conf-d-files
|
||||
fi
|
||||
echo 'Collecting X, xprop, glxinfo, xrandr, xdpyinfo data...'
|
||||
xprop -root &> $xiin_data_dir/xprop_root.txt
|
||||
glxinfo &> $xiin_data_dir/glxinfo.txt
|
||||
xdpyinfo &> $xiin_data_dir/xdpyinfo.txt
|
||||
xrandr &> $xiin_data_dir/xrandr.txt
|
||||
X -version &> $xiin_data_dir/x-version.txt
|
||||
Xorg -version &> $xiin_data_dir/xorg-version.txt
|
||||
xprop -root &> $debug_data_dir/xprop_root.txt
|
||||
glxinfo &> $debug_data_dir/glxinfo.txt
|
||||
xdpyinfo &> $debug_data_dir/xdpyinfo.txt
|
||||
xrandr &> $debug_data_dir/xrandr.txt
|
||||
X -version &> $debug_data_dir/x-version.txt
|
||||
Xorg -version &> $debug_data_dir/xorg-version.txt
|
||||
fi
|
||||
if [[ $1 == 'disk' || $1 == 'all' ]];then
|
||||
echo 'Collecting dev, label, disk, uuid data, df...'
|
||||
ls -l /dev &> $xiin_data_dir/dev-data.txt
|
||||
ls -l /dev/disk &> $xiin_data_dir/dev-disk-data.txt
|
||||
ls -l /dev/disk/by-id &> $xiin_data_dir/dev-disk-id-data.txt
|
||||
ls -l /dev/disk/by-label &> $xiin_data_dir/dev-disk-label-data.txt
|
||||
ls -l /dev/disk/by-uuid &> $xiin_data_dir/dev-disk-uuid-data.txt
|
||||
ls -l /dev/disk/by-path &> $xiin_data_dir/dev-disk-path-data.txt
|
||||
readlink /dev/root &> $xiin_data_dir/dev-root.txt
|
||||
df -h -T --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 --exclude-type=devfs --exclude-type=linprocfs --exclude-type=sysfs --exclude-type=fdescfs &> $xiin_data_dir/df-h-T-excludes.txt
|
||||
swapon -s &> $xiin_data_dir/swapon-s.txt
|
||||
df --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 &> $xiin_data_dir/df-excludes.txt
|
||||
cat $FILE_PARTITIONS &> $xiin_data_dir/proc-partitions.txt
|
||||
cat $FILE_SCSI &> $xiin_data_dir/proc-scsi.txt
|
||||
cat $FILE_MOUNTS &> $xiin_data_dir/proc-mounts.txt
|
||||
cat /proc/sys/dev/cdrom/info &> $xiin_data_dir/proc-cdrom-info.txt
|
||||
ls /proc/ide/ &> $xiin_data_dir/proc-ide.txt
|
||||
cat /proc/ide/*/* &> $xiin_data_dir/proc-ide-hdx-cat.txt
|
||||
cat /etc/fstab &> $xiin_data_dir/etc-fstab.txt
|
||||
cat /etc/mtab &> $xiin_data_dir/etc-mtab.txt
|
||||
ls -l /dev &> $debug_data_dir/dev-data.txt
|
||||
ls -l /dev/disk &> $debug_data_dir/dev-disk-data.txt
|
||||
ls -l /dev/disk/by-id &> $debug_data_dir/dev-disk-id-data.txt
|
||||
ls -l /dev/disk/by-label &> $debug_data_dir/dev-disk-label-data.txt
|
||||
ls -l /dev/disk/by-uuid &> $debug_data_dir/dev-disk-uuid-data.txt
|
||||
ls -l /dev/disk/by-path &> $debug_data_dir/dev-disk-path-data.txt
|
||||
readlink /dev/root &> $debug_data_dir/dev-root.txt
|
||||
df -h -T --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 --exclude-type=devfs --exclude-type=linprocfs --exclude-type=sysfs --exclude-type=fdescfs &> $debug_data_dir/df-h-T-excludes.txt
|
||||
swapon -s &> $debug_data_dir/swapon-s.txt
|
||||
df --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 &> $debug_data_dir/df-excludes.txt
|
||||
cat $FILE_PARTITIONS &> $debug_data_dir/proc-partitions.txt
|
||||
cat $FILE_SCSI &> $debug_data_dir/proc-scsi.txt
|
||||
cat $FILE_MOUNTS &> $debug_data_dir/proc-mounts.txt
|
||||
cat /proc/sys/dev/cdrom/info &> $debug_data_dir/proc-cdrom-info.txt
|
||||
ls /proc/ide/ &> $debug_data_dir/proc-ide.txt
|
||||
cat /proc/ide/*/* &> $debug_data_dir/proc-ide-hdx-cat.txt
|
||||
cat /etc/fstab &> $debug_data_dir/etc-fstab.txt
|
||||
cat /etc/mtab &> $debug_data_dir/etc-mtab.txt
|
||||
inxi_args='pluo'
|
||||
fi
|
||||
echo 'Creating inxi output file now. This can take a few seconds...'
|
||||
$SCRIPT_NAME -F$inxi_args -c 0 -@ 8 > $xiin_data_dir/inxi-F${inxi_args}.txt
|
||||
cp $LOG_FILE $SCRIPT_DATA_DIR/$xiin_data_dir
|
||||
$SCRIPT_NAME -F$inxi_args -c 0 -@ 8 > $debug_data_dir/inxi-F${inxi_args}.txt
|
||||
cp $LOG_FILE $SCRIPT_DATA_DIR/$debug_data_dir
|
||||
|
||||
echo 'Creating tar.gz compressed file of this material now. Contents:'
|
||||
echo '-------------------------'
|
||||
tar -cvzf $xiin_data_dir.tar.gz $xiin_data_dir
|
||||
tar -cvzf $debug_data_dir.tar.gz $debug_data_dir
|
||||
echo '-------------------------'
|
||||
echo 'Cleaning up leftovers...'
|
||||
rm -rf $xiin_data_dir
|
||||
rm -rf $debug_data_dir
|
||||
echo 'Testing gzip file integrity...'
|
||||
gzip -t $xiin_data_dir.tar.gz
|
||||
gzip -t $debug_data_dir.tar.gz
|
||||
if [[ $? -gt 0 ]];then
|
||||
echo 'Data in gz is corrupted, removing gzip file, try running data collector again.'
|
||||
rm -f $xiin_data_dir.tar.gz
|
||||
rm -f $debug_data_dir.tar.gz
|
||||
echo "Data in gz is corrupted, removed gzip file" >> $debug_data_dir/gzip-error.txt
|
||||
else
|
||||
echo 'All done, you can find your data gzipped directory here:'
|
||||
echo $SCRIPT_DATA_DIR/$xiin_data_dir.tar.gz
|
||||
echo $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz
|
||||
echo 'You can upload this here using most file managers: ftp.techpatterns.com/incoming'
|
||||
echo 'then let a maintainer know it is uploaded.'
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue