New version, new tarball. This fixes issue #119

The issue was not so much with xiin.py as with some new values in /sys that would
hang tree traverse, however, in order to remove the python dependency (except for
uploading -xx@ debugger data, until I can figure out how to do it with Perl), I
rewrote the tree traverse tool into Perl, which also makes it a lot faster and
easier to work with.

This issue appeared on kernel 4.11 as far as I can tell, some new values in /sys make
the traverse hang if it tries to read the values, **/parameters/** and **/debug/** seem
to be the main culprits, but inxi doesn't need that data anyway for debugging purposes
so it's just excluded.
This commit is contained in:
Harald Hope 2017-08-16 00:41:41 -07:00
parent fd13a1efde
commit 29fd891c63
2 changed files with 413 additions and 290 deletions

680
inxi
View file

@ -2,8 +2,8 @@
########################################################################
SELF_NAME='inxi'
# don't quote the following, parsers grab these too
SELF_VERSION=2.3.35
SELF_DATE=2017-08-11
SELF_VERSION=2.3.36
SELF_DATE=2017-08-16
SELF_PATCH=00
########################################################################
#### SPECIAL THANKS
@ -1764,14 +1764,12 @@ set_man_location()
# args: $1 - debug data type: sys|xorg|disk
debug_data_collector()
{
local xiin_app='' xiin_data_file='' xiin_download='' error='' b_run_xiin='false'
local debug_data_dir='' bsd_string='' xorg_d_files='' xorg_file='' a_distro_ids=''
local completed_gz_file='' xiin_file='xiin.py' ftp_upload='ftp.techpatterns.com/incoming'
local xiin_url="https://github.com/smxi/inxi/raw/xiin/$xiin_file"
local Line='-------------------------' root_string=''
local xiin_app='' xiin_data_file='' error='' b_run_xiin='false' b_xiin_downloaded='false'
local Debug_Data_Dir='' bsd_string='' xorg_d_files='' xorg_file='' a_distro_ids=''
local completed_gz_file='' Xiin_File='xiin.py' ftp_upload='ftp.techpatterns.com/incoming'
local Line='-------------------------'
local start_directory=$( pwd )
local host=''
local downloader_error=0 debug_i=''
local host='' debug_i='' root_string=''
if (( "$BASH" >= 4 ));then
host="${HOSTNAME,,}"
@ -1795,7 +1793,7 @@ debug_data_collector()
root_string='-root'
fi
debug_data_dir="inxi$bsd_string-$host-$(date +%Y%m%d-%H%M%S)-$1$root_string"
Debug_Data_Dir="inxi$bsd_string-$host-$(date +%Y%m%d-%H%M%S)-$1$root_string"
if [[ $B_IRC == 'false' ]];then
if [[ -n $ALTERNATE_FTP ]];then
@ -1803,470 +1801,507 @@ debug_data_collector()
fi
echo "Starting debugging data collection type: $1"
cd $SELF_DATA_DIR
if [[ -d $SELF_DATA_DIR/$debug_data_dir ]];then
if [[ -d $SELF_DATA_DIR/$Debug_Data_Dir ]];then
echo 'Deleting previous xiin data directory...'
rm -rf $SELF_DATA_DIR/$debug_data_dir
rm -rf $SELF_DATA_DIR/$Debug_Data_Dir
fi
mkdir $SELF_DATA_DIR/$debug_data_dir
if [[ -f $SELF_DATA_DIR/$debug_data_dir.tar.gz ]];then
mkdir $SELF_DATA_DIR/$Debug_Data_Dir
if [[ -f $SELF_DATA_DIR/$Debug_Data_Dir.tar.gz ]];then
echo 'Deleting previous tar.gz file...'
rm -f $SELF_DATA_DIR/$debug_data_dir.tar.gz
rm -f $SELF_DATA_DIR/$Debug_Data_Dir.tar.gz
fi
echo 'Collecting system info: sensors, lsusb, lspci, lspci -v data, plus /proc data'
echo 'also checking for dmidecode data: note, you must be root to have dmidecode work.'
echo "Data going into: $SELF_DATA_DIR/$debug_data_dir"
echo "Data going into: $SELF_DATA_DIR/$Debug_Data_Dir"
# bsd tools http://cb.vu/unixtoolbox.xhtml
# freebsd
if type -p pciconf &>/dev/null;then
pciconf -l -cv &> $debug_data_dir/bsd-pciconf-cvl.txt
pciconf -vl &> $debug_data_dir/bsd-pciconf-vl.txt
pciconf -l &> $debug_data_dir/bsd-pciconf-l.txt
pciconf -l -cv &> $Debug_Data_Dir/bsd-pciconf-cvl.txt
pciconf -vl &> $Debug_Data_Dir/bsd-pciconf-vl.txt
pciconf -l &> $Debug_Data_Dir/bsd-pciconf-l.txt
else
touch $debug_data_dir/bsd-pciconf-absent
touch $Debug_Data_Dir/bsd-pciconf-absent
fi
# openbsd
if type -p pcidump &>/dev/null;then
pcidump &> $debug_data_dir/bsd-pcidump-openbsd.txt
pcidump -v &> $debug_data_dir/bsd-pcidump-v-openbsd.txt
pcidump &> $Debug_Data_Dir/bsd-pcidump-openbsd.txt
pcidump -v &> $Debug_Data_Dir/bsd-pcidump-v-openbsd.txt
else
touch $debug_data_dir/bsd-pcidump-openbsd-absent
touch $Debug_Data_Dir/bsd-pcidump-openbsd-absent
fi
# netbsd
if type -p pcictl &>/dev/null;then
pcictl list &> $debug_data_dir/bsd-pcictl-list-netbsd.txt
pcictl list -n &> $debug_data_dir/bsd-pcictl-list-n-netbsd.txt
pcictl list &> $Debug_Data_Dir/bsd-pcictl-list-netbsd.txt
pcictl list -n &> $Debug_Data_Dir/bsd-pcictl-list-n-netbsd.txt
else
touch $debug_data_dir/bsd-pcictl-netbsd-absent
touch $Debug_Data_Dir/bsd-pcictl-netbsd-absent
fi
if type -p sysctl &>/dev/null;then
sysctl -a &> $debug_data_dir/bsd-sysctl-a.txt
sysctl -a &> $Debug_Data_Dir/bsd-sysctl-a.txt
else
touch $debug_data_dir/bsd-sysctl-absent
touch $Debug_Data_Dir/bsd-sysctl-absent
fi
if type -p usbdevs &>/dev/null;then
usbdevs -v &> $debug_data_dir/bsd-usbdevs-v.txt
usbdevs -v &> $Debug_Data_Dir/bsd-usbdevs-v.txt
else
touch $debug_data_dir/bsd-usbdevs-absent
touch $Debug_Data_Dir/bsd-usbdevs-absent
fi
if type -p kldstat &>/dev/null;then
kldstat &> $debug_data_dir/bsd-kldstat.txt
kldstat &> $Debug_Data_Dir/bsd-kldstat.txt
else
touch $debug_data_dir/bsd-kldstat-absent
touch $Debug_Data_Dir/bsd-kldstat-absent
fi
# diskinfo -v <disk>
# fdisk <disk>
dmidecode &> $debug_data_dir/dmidecode.txt
dmidecode &> $Debug_Data_Dir/dmidecode.txt
get_repo_data "$SELF_DATA_DIR/$debug_data_dir"
get_repo_data "$SELF_DATA_DIR/$Debug_Data_Dir"
if type -p shopt &>/dev/null;then
shopt -s nullglob
a_distro_ids=(/etc/*[-_]{release,version})
shopt -u nullglob
echo ${a_distro_ids[@]} &> $debug_data_dir/etc-distro-files.txt
echo ${a_distro_ids[@]} &> $Debug_Data_Dir/etc-distro-files.txt
for distro_file in ${a_distro_ids[@]} /etc/issue
do
if [[ -f $distro_file ]];then
cat $distro_file &> $debug_data_dir/distro-file${distro_file//\//-}
cat $distro_file &> $Debug_Data_Dir/distro-file${distro_file//\//-}
fi
done
fi
dmesg &> $debug_data_dir/dmesg.txt
lscpu &> $debug_data_dir/lscpu.txt
lspci &> $debug_data_dir/lspci.txt
lspci -k &> $debug_data_dir/lspci-k.txt
lspci -knn &> $debug_data_dir/lspci-knn.txt
lspci -n &> $debug_data_dir/lspci-n.txt
lspci -nn &> $debug_data_dir/lspci-nn.txt
lspci -mm &> $debug_data_dir/lspci-mm.txt
lspci -mmnn &> $debug_data_dir/lspci-mmnn.txt
lspci -mmnnv &> $debug_data_dir/lspci-mmnnv.txt
lspci -v &> $debug_data_dir/lspci-v.txt
lsusb &> $debug_data_dir/lsusb.txt
dmesg &> $Debug_Data_Dir/dmesg.txt
lscpu &> $Debug_Data_Dir/lscpu.txt
lspci &> $Debug_Data_Dir/lspci.txt
lspci -k &> $Debug_Data_Dir/lspci-k.txt
lspci -knn &> $Debug_Data_Dir/lspci-knn.txt
lspci -n &> $Debug_Data_Dir/lspci-n.txt
lspci -nn &> $Debug_Data_Dir/lspci-nn.txt
lspci -mm &> $Debug_Data_Dir/lspci-mm.txt
lspci -mmnn &> $Debug_Data_Dir/lspci-mmnn.txt
lspci -mmnnv &> $Debug_Data_Dir/lspci-mmnnv.txt
lspci -v &> $Debug_Data_Dir/lspci-v.txt
lsusb &> $Debug_Data_Dir/lsusb.txt
if type -p hciconfig &>/dev/null;then
hciconfig -a &> $debug_data_dir/hciconfig-a.txt
hciconfig -a &> $Debug_Data_Dir/hciconfig-a.txt
else
touch $debug_data_dir/hciconfig-absent
touch $Debug_Data_Dir/hciconfig-absent
fi
ls /sys &> $debug_data_dir/ls-sys.txt
ps aux &> $debug_data_dir/ps-aux.txt
ps -e &> $debug_data_dir/ps-e.txt
ps -p 1 &> $debug_data_dir/ps-p-1.txt
cat /proc/1/comm &> $debug_data_dir/proc-1-comm.txt
runlevel &> $debug_data_dir/runlevel.txt
ls /sys &> $Debug_Data_Dir/ls-sys.txt
ps aux &> $Debug_Data_Dir/ps-aux.txt
ps -e &> $Debug_Data_Dir/ps-e.txt
ps -p 1 &> $Debug_Data_Dir/ps-p-1.txt
cat /proc/1/comm &> $Debug_Data_Dir/proc-1-comm.txt
runlevel &> $Debug_Data_Dir/runlevel.txt
if type -p rc-status &>/dev/null;then
rc-status -a &> $debug_data_dir/rc-status-a.txt
rc-status -l &> $debug_data_dir/rc-status-l.txt
rc-status -r &> $debug_data_dir/rc-status-r.txt
rc-status -a &> $Debug_Data_Dir/rc-status-a.txt
rc-status -l &> $Debug_Data_Dir/rc-status-l.txt
rc-status -r &> $Debug_Data_Dir/rc-status-r.txt
else
touch $debug_data_dir/rc-status-absent
touch $Debug_Data_Dir/rc-status-absent
fi
if type -p systemctl &>/dev/null;then
systemctl list-units &> $debug_data_dir/systemctl-list-units.txt
systemctl list-units --type=target &> $debug_data_dir/systemctl-list-units-target.txt
systemctl list-units &> $Debug_Data_Dir/systemctl-list-units.txt
systemctl list-units --type=target &> $Debug_Data_Dir/systemctl-list-units-target.txt
else
touch $debug_data_dir/systemctl-absent
touch $Debug_Data_Dir/systemctl-absent
fi
if type -p initctl &>/dev/null;then
initctl list &> $debug_data_dir/initctl-list.txt
initctl list &> $Debug_Data_Dir/initctl-list.txt
else
touch $debug_data_dir/initctl-absent
touch $Debug_Data_Dir/initctl-absent
fi
sensors &> $debug_data_dir/sensors.txt
sensors &> $Debug_Data_Dir/sensors.txt
if type -p strings &>/dev/null;then
touch $debug_data_dir/strings-present
touch $Debug_Data_Dir/strings-present
else
touch $debug_data_dir/strings-absent
touch $Debug_Data_Dir/strings-absent
fi
local id_dir='/sys/class/power_supply/'
local ids=$( ls $id_dir 2>/dev/null )
if [[ -n $ids ]];then
for batid in $ids
do
cat $id_dir$batid'/uevent' &> $debug_data_dir/sys-power-supply-$batid.txt
cat $id_dir$batid'/uevent' &> $Debug_Data_Dir/sys-power-supply-$batid.txt
done
else
touch $debug_data_dir/sys-power-supply-none
touch $Debug_Data_Dir/sys-power-supply-none
fi
# leaving this commented out to remind that some systems do not
# support strings --version, but will just simply hang at that command
# which you can duplicate by simply typing: strings then hitting enter, you will get hang.
# strings --version &> $debug_data_dir/strings.txt
# strings --version &> $Debug_Data_Dir/strings.txt
if type -p nvidia-smi &>/dev/null;then
nvidia-smi -q &> $debug_data_dir/nvidia-smi-q.txt
nvidia-smi -q -x &> $debug_data_dir/nvidia-smi-xq.txt
nvidia-smi -q &> $Debug_Data_Dir/nvidia-smi-q.txt
nvidia-smi -q -x &> $Debug_Data_Dir/nvidia-smi-xq.txt
else
touch $debug_data_dir/nvidia-smi-absent
touch $Debug_Data_Dir/nvidia-smi-absent
fi
head -n 1 /proc/asound/card*/codec* &> $debug_data_dir/proc-asound-card-codec.txt
head -n 1 /proc/asound/card*/codec* &> $Debug_Data_Dir/proc-asound-card-codec.txt
if [[ -f /proc/version ]];then
cat /proc/version &> $debug_data_dir/proc-version.txt
cat /proc/version &> $Debug_Data_Dir/proc-version.txt
else
touch $debug_data_dir/proc-version-absent
touch $Debug_Data_Dir/proc-version-absent
fi
echo $CC &> $debug_data_dir/cc-content.txt
ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt
echo $CC &> $Debug_Data_Dir/cc-content.txt
ls /usr/bin/gcc* &> $Debug_Data_Dir/gcc-sys-versions.txt
if type -p gcc &>/dev/null;then
gcc --version &> $debug_data_dir/gcc-version.txt
gcc --version &> $Debug_Data_Dir/gcc-version.txt
else
touch $debug_data_dir/gcc-absent
touch $Debug_Data_Dir/gcc-absent
fi
if type -p clang &>/dev/null;then
clang --version &> $debug_data_dir/clang-version.txt
clang --version &> $Debug_Data_Dir/clang-version.txt
else
touch $debug_data_dir/clang-absent
touch $Debug_Data_Dir/clang-absent
fi
if type -p systemd-detect-virt &>/dev/null;then
systemd-detect-virt &> $debug_data_dir/systemd-detect-virt-info.txt
systemd-detect-virt &> $Debug_Data_Dir/systemd-detect-virt-info.txt
else
touch $debug_data_dir/systemd-detect-virt-absent
touch $Debug_Data_Dir/systemd-detect-virt-absent
fi
cat /etc/src.conf &> $debug_data_dir/bsd-etc-src-conf.txt
cat /etc/make.conf &> $debug_data_dir/bsd-etc-make-conf.txt
cat /etc/issue &> $debug_data_dir/etc-issue.txt
cat $FILE_LSB_RELEASE &> $debug_data_dir/lsb-release.txt
cat $FILE_OS_RELEASE &> $debug_data_dir/os-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
cat /proc/net/arp &> $debug_data_dir/proc-net-arp.txt
cat /etc/src.conf &> $Debug_Data_Dir/bsd-etc-src-conf.txt
cat /etc/make.conf &> $Debug_Data_Dir/bsd-etc-make-conf.txt
cat /etc/issue &> $Debug_Data_Dir/etc-issue.txt
cat $FILE_LSB_RELEASE &> $Debug_Data_Dir/lsb-release.txt
cat $FILE_OS_RELEASE &> $Debug_Data_Dir/os-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
cat /proc/net/arp &> $Debug_Data_Dir/proc-net-arp.txt
# bsd data
cat /var/run/dmesg.boot &> $debug_data_dir/bsd-var-run-dmesg.boot.txt
echo $COLS_INNER &> $debug_data_dir/cols-inner.txt
echo $XDG_CONFIG_HOME &> $debug_data_dir/xdg_config_home.txt
echo $XDG_CONFIG_DIRS &> $debug_data_dir/xdg_config_dirs.txt
echo $XDG_DATA_HOME &> $debug_data_dir/xdg_data_home.txt
echo $XDG_DATA_DIRS &> $debug_data_dir/xdg_data_dirs.txt
cat /var/run/dmesg.boot &> $Debug_Data_Dir/bsd-var-run-dmesg.boot.txt
echo $COLS_INNER &> $Debug_Data_Dir/cols-inner.txt
echo $XDG_CONFIG_HOME &> $Debug_Data_Dir/xdg_config_home.txt
echo $XDG_CONFIG_DIRS &> $Debug_Data_Dir/xdg_config_dirs.txt
echo $XDG_DATA_HOME &> $Debug_Data_Dir/xdg_data_home.txt
echo $XDG_DATA_DIRS &> $Debug_Data_Dir/xdg_data_dirs.txt
check_recommends_user_output &> $debug_data_dir/check-recommends-user-output.txt
# first download and verify xiin
if [[ $B_UPLOAD_DEBUG_DATA == 'true' || $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
touch $SELF_DATA_DIR/$debug_data_dir/xiin-error.txt
echo "Downloading required tree traverse tool $xiin_file..."
if [[ -f xiin && ! -f $xiin_file ]];then
mv -f xiin $xiin_file
fi
# -Nc is creating really weird download anomalies, so using -O instead
case $DOWNLOADER in
curl)
xiin_download="$( curl $NO_SSL_OPT -s $xiin_url )" || downloader_error=$?
;;
fetch)
xiin_download="$( fetch $NO_SSL_OPT -q -o - $xiin_url )" || downloader_error=$?
;;
ftp)
xiin_download="$( ftp $NO_SSL_OPT -o - $xiin_url 2>/dev/null )" || downloader_error=$?
;;
wget)
xiin_download="$( wget $NO_SSL_OPT -q -O - $xiin_url )" || downloader_error=$?
;;
no-downloader)
downloader_error=1
;;
esac
# if nothing got downloaded kick out error, otherwise we'll use an older version
if [[ $downloader_error -gt 0 && ! -f $xiin_file ]];then
echo -e "ERROR: Failed to download required file: $xiin_file\nMaybe the remote site is down or your networking is broken?"
echo "Continuing with incomplete data collection."
echo "$xiin_file download failed and no existing $xiin_file" >> $debug_data_dir/xiin-error.txt
elif [[ -n $( grep -s '# EOF' <<< "$xiin_download" ) || -f $xiin_file ]];then
if [[ -n $( grep -s '# EOF' <<< "$xiin_download" ) ]];then
echo "Updating $xiin_file from remote location"
echo "$xiin_download" > $xiin_file
else
echo "Using local $xiin_file due to download failure"
fi
b_run_xiin='true'
else
echo -e "ERROR: $xiin_file downloaded but the program file data is corrupted.\nContinuing with incomplete data collection."
echo "$xiin_file downloaded but the program file data is corrupted." >> $debug_data_dir/xiin-error.txt
fi
fi
# note, only bash 4> supports ;;& for case, so using if/then here
if [[ $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
xiin_data_file=$SELF_DATA_DIR/$debug_data_dir/xiin-sys.txt
echo 'Collecting networking data...'
ifconfig &> $debug_data_dir/ifconfig.txt
ip addr &> $debug_data_dir/ip-addr.txt
# f="$( find /sys -mindepth 1 -type f -exec gawk 'END { print FILENAME ":[" $0 "]"}' 2>/dev/null {} \; )" 2>/dev/null;echo "$f"
# https://stackoverflow.com/questions/5119946/find-exec-with-multiple-commands
if [[ $b_run_xiin == 'true' && -z $BSD_TYPE ]];then
echo $Line
echo "Running $xiin_file tool now on /sys..."
echo "Using Python version:" && python --version
python --version &> $debug_data_dir/python-version.txt
python ./$xiin_file -d /sys -f $xiin_data_file
if [[ $? -ne 0 ]];then
error=$?
echo -e "ERROR: $xiin_file exited with error $error - removing data file.\nContinuing with incomplete data collection."
echo "Continuing with incomplete data collection."
rm -f $xiin_data_file
echo "$xiin_file data generation failed with python error $error" >> $debug_data_dir/xiin-error.txt
fi
echo $Line
fi
fi
check_recommends_user_output &> $Debug_Data_Dir/check-recommends-user-output.txt
if [[ $1 == 'xorg' || $1 == 'all' ]];then
if [[ $B_RUNNING_IN_DISPLAY != 'true' ]];then
echo 'Warning: only some of the data collection can occur if you are not in X'
touch $debug_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 $debug_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 &> $debug_data_dir/xorg-log-file.txt
cat $FILE_XORG_LOG &> $Debug_Data_Dir/xorg-log-file.txt
else
touch $debug_data_dir/xorg-log-file-absent
touch $Debug_Data_Dir/xorg-log-file-absent
fi
if [[ -e /etc/X11/xorg.conf ]];then
cat /etc/X11/xorg.conf &> $debug_data_dir/xorg-conf.txt
cat /etc/X11/xorg.conf &> $Debug_Data_Dir/xorg-conf.txt
else
touch $debug_data_dir/xorg-conf-file-absent
touch $Debug_Data_Dir/xorg-conf-file-absent
fi
if [[ -n $( ls /etc/X11/xorg.conf.d/ 2>/dev/null ) ]];then
ls /etc/X11/xorg.conf.d &> $debug_data_dir/ls-etc-x11-xorg-conf-d.txt
ls /etc/X11/xorg.conf.d &> $Debug_Data_Dir/ls-etc-x11-xorg-conf-d.txt
xorg_d_files=$(ls /etc/X11/xorg.conf.d)
for xorg_file in $xorg_d_files
do
cat /etc/X11/xorg.conf.d/$xorg_file &> $debug_data_dir/xorg-conf-d-$xorg_file.txt
cat /etc/X11/xorg.conf.d/$xorg_file &> $Debug_Data_Dir/xorg-conf-d-$xorg_file.txt
done
else
touch $debug_data_dir/xorg-conf-d-files-absent
touch $Debug_Data_Dir/xorg-conf-d-files-absent
fi
echo 'Collecting X, xprop, glxinfo, xrandr, xdpyinfo data, wayland, weston...'
if type -p weston-info &>/dev/null; then
weston-info &> $debug_data_dir/weston-info.txt
weston-info &> $Debug_Data_Dir/weston-info.txt
else
touch $debug_data_dir/weston-info-absent
touch $Debug_Data_Dir/weston-info-absent
fi
if type -p weston &>/dev/null; then
weston --version &> $debug_data_dir/weston-version.txt
weston --version &> $Debug_Data_Dir/weston-version.txt
else
touch $debug_data_dir/weston-absent
touch $Debug_Data_Dir/weston-absent
fi
if type -p xprop &>/dev/null; then
xprop -root &> $debug_data_dir/xprop_root.txt
xprop -root &> $Debug_Data_Dir/xprop_root.txt
else
touch $debug_data_dir/xprop-absent
touch $Debug_Data_Dir/xprop-absent
fi
if type -p glxinfo &>/dev/null; then
glxinfo &> $debug_data_dir/glxinfo-full.txt
glxinfo -B &> $debug_data_dir/glxinfo-B.txt
glxinfo &> $Debug_Data_Dir/glxinfo-full.txt
glxinfo -B &> $Debug_Data_Dir/glxinfo-B.txt
else
touch $debug_data_dir/glxinfo-absent
touch $Debug_Data_Dir/glxinfo-absent
fi
if type -p xdpyinfo &>/dev/null; then
xdpyinfo &> $debug_data_dir/xdpyinfo.txt
xdpyinfo &> $Debug_Data_Dir/xdpyinfo.txt
else
touch $debug_data_dir/xdpyinfo-absent
touch $Debug_Data_Dir/xdpyinfo-absent
fi
if type -p xrandr &>/dev/null; then
xrandr &> $debug_data_dir/xrandr.txt
xrandr &> $Debug_Data_Dir/xrandr.txt
else
touch $debug_data_dir/xrandr-absent
touch $Debug_Data_Dir/xrandr-absent
fi
if type -p X &>/dev/null; then
X -version &> $debug_data_dir/x-version.txt
X -version &> $Debug_Data_Dir/x-version.txt
else
touch $debug_data_dir/x-absent
touch $Debug_Data_Dir/x-absent
fi
if type -p Xorg &>/dev/null; then
Xorg -version &> $debug_data_dir/xorg-version.txt
Xorg -version &> $Debug_Data_Dir/xorg-version.txt
else
touch $debug_data_dir/xorg-absent
touch $Debug_Data_Dir/xorg-absent
fi
echo $GNOME_DESKTOP_SESSION_ID &> $debug_data_dir/gnome-desktop-session-id.txt
echo $GNOME_DESKTOP_SESSION_ID &> $Debug_Data_Dir/gnome-desktop-session-id.txt
# kde 3 id
echo $KDE_FULL_SESSION &> $debug_data_dir/kde3-full-session.txt
echo $KDE_SESSION_VERSION &> $debug_data_dir/kde-gte-4-session-version.txt
echo $KDE_FULL_SESSION &> $Debug_Data_Dir/kde3-full-session.txt
echo $KDE_SESSION_VERSION &> $Debug_Data_Dir/kde-gte-4-session-version.txt
if type -p kf5-config &>/dev/null; then
kf5-config --version &> $debug_data_dir/kde-kf5-config-version-data.txt
kf5-config --version &> $Debug_Data_Dir/kde-kf5-config-version-data.txt
elif type -p kf6-config &>/dev/null; then
kf6-config --version &> $debug_data_dir/kde-kf6-config-version-data.txt
kf6-config --version &> $Debug_Data_Dir/kde-kf6-config-version-data.txt
elif type -p kf$KDE_SESSION_VERSION-config &>/dev/null; then
kf$KDE_SESSION_VERSION-config --version &> $debug_data_dir/kde-kf$KDE_SESSION_VERSION-KSV-config-version-data.txt
kf$KDE_SESSION_VERSION-config --version &> $Debug_Data_Dir/kde-kf$KDE_SESSION_VERSION-KSV-config-version-data.txt
else
touch $debug_data_dir/kde-kf-config-absent
touch $Debug_Data_Dir/kde-kf-config-absent
fi
if type -p plasmashell &>/dev/null; then
plasmashell --version &> $debug_data_dir/kde-plasmashell-version-data.txt
plasmashell --version &> $Debug_Data_Dir/kde-plasmashell-version-data.txt
else
touch $debug_data_dir/kde-plasmashell-absent
touch $Debug_Data_Dir/kde-plasmashell-absent
fi
if type -p kwin_x11 &>/dev/null; then
kwin_x11 --version &> $debug_data_dir/kde-kwin_x11-version-data.txt
kwin_x11 --version &> $Debug_Data_Dir/kde-kwin_x11-version-data.txt
else
touch $debug_data_dir/kde-kwin_x11-absent
touch $Debug_Data_Dir/kde-kwin_x11-absent
fi
if type -p kded4 &>/dev/null; then
kded4 --version &> $debug_data_dir/kded4-version-data.txt
kded4 --version &> $Debug_Data_Dir/kded4-version-data.txt
elif type -p kded5 &>/dev/null; then
kded5 --version &> $debug_data_dir/kded5-version-data.txt
kded5 --version &> $Debug_Data_Dir/kded5-version-data.txt
elif type -p kded &>/dev/null; then
kded --version &> $debug_data_dir/kded-version-data.txt
kded --version &> $Debug_Data_Dir/kded-version-data.txt
else
touch $debug_data_dir/kded-$KDE_SESSION_VERSION-absent
touch $Debug_Data_Dir/kded-$KDE_SESSION_VERSION-absent
fi
# kde 5/plasma desktop 5, this is maybe an extra package and won't be used
if type -p about-distro &>/dev/null; then
about-distro &> $debug_data_dir/kde-about-distro.txt
about-distro &> $Debug_Data_Dir/kde-about-distro.txt
else
touch $debug_data_dir/kde-about-distro-absent
touch $Debug_Data_Dir/kde-about-distro-absent
fi
echo $XDG_CURRENT_DESKTOP &> $debug_data_dir/xdg-current-desktop.txt
echo $XDG_SESSION_DESKTOP &> $debug_data_dir/xdg-session-desktop.txt
echo $DESKTOP_SESSION &> $debug_data_dir/desktop-session.txt
echo $GDMSESSION &> $debug_data_dir/gdmsession.txt
echo $XDG_CURRENT_DESKTOP &> $Debug_Data_Dir/xdg-current-desktop.txt
echo $XDG_SESSION_DESKTOP &> $Debug_Data_Dir/xdg-session-desktop.txt
echo $DESKTOP_SESSION &> $Debug_Data_Dir/desktop-session.txt
echo $GDMSESSION &> $Debug_Data_Dir/gdmsession.txt
# wayland data collectors:
echo $XDG_SESSION_TYPE &> $debug_data_dir/xdg-session-type.txt
echo $WAYLAND_DISPLAY &> $debug_data_dir/wayland-display.txt
echo $GDK_BACKEND &> $debug_data_dir/gdk-backend.txt
echo $QT_QPA_PLATFORM &> $debug_data_dir/qt-qpa-platform.txt
echo $CLUTTER_BACKEND &> $debug_data_dir/clutter-backend.txt
echo $SDL_VIDEODRIVER &> $debug_data_dir/sdl-videodriver.txt
echo $XDG_SESSION_TYPE &> $Debug_Data_Dir/xdg-session-type.txt
echo $WAYLAND_DISPLAY &> $Debug_Data_Dir/wayland-display.txt
echo $GDK_BACKEND &> $Debug_Data_Dir/gdk-backend.txt
echo $QT_QPA_PLATFORM &> $Debug_Data_Dir/qt-qpa-platform.txt
echo $CLUTTER_BACKEND &> $Debug_Data_Dir/clutter-backend.txt
echo $SDL_VIDEODRIVER &> $Debug_Data_Dir/sdl-videodriver.txt
if type -p loginctl &>/dev/null;then
loginctl --no-pager list-sessions &> $debug_data_dir/loginctl-list-sessions.txt
loginctl --no-pager list-sessions &> $Debug_Data_Dir/loginctl-list-sessions.txt
else
touch $debug_data_dir/loginctl-absent
touch $Debug_Data_Dir/loginctl-absent
fi
fi
if [[ $1 == 'disk' || $1 == 'all' ]];then
echo 'Collecting dev, label, disk, uuid data, df...'
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 &> $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
# http://comments.gmane.org/gmane.linux.file-systems.zfs.user/2032
ls -l /dev/disk/by-wwn &> $debug_data_dir/dev-disk-wwn-data.txt
ls -l /dev/disk/by-path &> $debug_data_dir/dev-disk-path-data.txt
ls -l /dev/mapper &> $debug_data_dir/dev-disk-mapper-data.txt
readlink /dev/root &> $debug_data_dir/dev-root.txt
df -h -T -P --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-P-excludes.txt
df -T -P --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-T-P-excludes.txt
df -T -P --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 --total &> $debug_data_dir/df-T-P-excludes-total.txt
df -h -T &> $debug_data_dir/bsd-df-h-T-no-excludes.txt
df -h &> $debug_data_dir/bsd-df-h-no-excludes.txt
df -k -T &> $debug_data_dir/bsd-df-k-T-no-excludes.txt
df -k &> $debug_data_dir/bsd-df-k-no-excludes.txt
atacontrol list &> $debug_data_dir/bsd-atacontrol-list.txt
camcontrol devlist &> $debug_data_dir/bsd-camcontrol-devlist.txt
ls -l /dev/disk/by-wwn &> $Debug_Data_Dir/dev-disk-wwn-data.txt
ls -l /dev/disk/by-path &> $Debug_Data_Dir/dev-disk-path-data.txt
ls -l /dev/mapper &> $Debug_Data_Dir/dev-disk-mapper-data.txt
readlink /dev/root &> $Debug_Data_Dir/dev-root.txt
df -h -T -P --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-P-excludes.txt
df -T -P --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-T-P-excludes.txt
df -T -P --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 --total &> $Debug_Data_Dir/df-T-P-excludes-total.txt
df -h -T &> $Debug_Data_Dir/bsd-df-h-T-no-excludes.txt
df -h &> $Debug_Data_Dir/bsd-df-h-no-excludes.txt
df -k -T &> $Debug_Data_Dir/bsd-df-k-T-no-excludes.txt
df -k &> $Debug_Data_Dir/bsd-df-k-no-excludes.txt
atacontrol list &> $Debug_Data_Dir/bsd-atacontrol-list.txt
camcontrol devlist &> $Debug_Data_Dir/bsd-camcontrol-devlist.txt
# bsd tool
mount &> $debug_data_dir/mount.txt
btrfs filesystem show &> $debug_data_dir/btrfs-filesystem-show.txt
btrfs filesystem show --mounted &> $debug_data_dir/btrfs-filesystem-show-mounted.txt
# btrfs filesystem show --all-devices &> $debug_data_dir/btrfs-filesystem-show-all-devices.txt
gpart list &> $debug_data_dir/bsd-gpart-list.txt
gpart show &> $debug_data_dir/bsd-gpart-show.txt
gpart status &> $debug_data_dir/bsd-gpart-status.txt
swapctl -l -k &> $debug_data_dir/bsd-swapctl-l-k.txt
swapon -s &> $debug_data_dir/swapon-s.txt
sysctl -b kern.geom.conftxt &> $debug_data_dir/bsd-sysctl-b-kern.geom.conftxt.txt
sysctl -b kern.geom.confxml &> $debug_data_dir/bsd-sysctl-b-kern.geom.confxml.txt
zfs list &> $debug_data_dir/bsd-zfs-list.txt
zpool list &> $debug_data_dir/bsd-zpool-list.txt
zpool list -v &> $debug_data_dir/bsd-zpool-list-v.txt
df -P --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 &> $debug_data_dir/df-P-excludes.txt
df -P &> $debug_data_dir/bsd-df-P-no-excludes.txt
cat /proc/mdstat &> $debug_data_dir/proc-mdstat.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
mount &> $Debug_Data_Dir/mount.txt
btrfs filesystem show &> $Debug_Data_Dir/btrfs-filesystem-show.txt
btrfs filesystem show --mounted &> $Debug_Data_Dir/btrfs-filesystem-show-mounted.txt
# btrfs filesystem show --all-devices &> $Debug_Data_Dir/btrfs-filesystem-show-all-devices.txt
gpart list &> $Debug_Data_Dir/bsd-gpart-list.txt
gpart show &> $Debug_Data_Dir/bsd-gpart-show.txt
gpart status &> $Debug_Data_Dir/bsd-gpart-status.txt
swapctl -l -k &> $Debug_Data_Dir/bsd-swapctl-l-k.txt
swapon -s &> $Debug_Data_Dir/swapon-s.txt
sysctl -b kern.geom.conftxt &> $Debug_Data_Dir/bsd-sysctl-b-kern.geom.conftxt.txt
sysctl -b kern.geom.confxml &> $Debug_Data_Dir/bsd-sysctl-b-kern.geom.confxml.txt
zfs list &> $Debug_Data_Dir/bsd-zfs-list.txt
zpool list &> $Debug_Data_Dir/bsd-zpool-list.txt
zpool list -v &> $Debug_Data_Dir/bsd-zpool-list-v.txt
df -P --exclude-type=aufs --exclude-type=squashfs --exclude-type=unionfs --exclude-type=devtmpfs --exclude-type=tmpfs --exclude-type=iso9660 &> $Debug_Data_Dir/df-P-excludes.txt
df -P &> $Debug_Data_Dir/bsd-df-P-no-excludes.txt
cat /proc/mdstat &> $Debug_Data_Dir/proc-mdstat.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
fi
echo 'Creating inxi output file now. This can take a few seconds...'
if [[ $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
echo 'Collecting networking data...'
ifconfig &> $Debug_Data_Dir/ifconfig.txt
ip addr &> $Debug_Data_Dir/ip-addr.txt
fi
# first download and verify xiin
if [[ $B_UPLOAD_DEBUG_DATA == 'true' || $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
touch $SELF_DATA_DIR/$Debug_Data_Dir/xiin-error.txt
fi
# note, only bash 4> supports ;;& for case, so using if/then here
if [[ -z $BSD_TYPE ]] && [[ $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then
echo $Line
xiin_data_file=$SELF_DATA_DIR/$Debug_Data_Dir/xiin-sys.txt
touch $xiin_data_file
if type -p perl &>/dev/null;then
echo "Collecting data from /sys..."
echo -n "Using Perl: " && perl --version | grep -oE 'v[0-9.]+'
xiin_data="$( perl -e '
use File::Find;
use strict;
# use warnings;
use 5.010;
my @content = ();
find( \&wanted, "/sys");
process_data( @content );
sub wanted {
return if -d; # not directory
return unless -e; # Must exist
return unless -r; # Must be readable
return unless -f; # Must be file
# note: a new file in 4.11 /sys can hang this, it is /parameter/ then
# a few variables. Since inxi does not need to see that file, we will
# not use it. Also do not need . files or __ starting files
return if $File::Find::name =~ /\/(\.[a-z]|__|parameters\/|debug\/)/;
# comment this one out if you experience hangs or if
# we discover syntax of foreign language characters
return unless -T; # Must be ascii like
# print $File::Find::name . "\n";
push @content, $File::Find::name;
return;
}
sub process_data {
my $result = "";
my $row = "";
my $fh;
my $data="";
my $sep="";
# no sorts, we want the order it comes in
# @content = sort @content;
foreach (@content){
$data="";
$sep="";
open($fh, "<$_");
while ($row = <$fh>) {
chomp $row;
$data .= $sep . "\"" . $row . "\"";
$sep=", ";
}
$result .= "$_:[$data]\n";
# print "$_:[$data]\n"
}
# print scalar @content . "\n";
print "$result";
} ' )"
if [[ -z "$xiin_data" ]];then
echo -e "ERROR: failed to generate /sys data - removing data file.\nContinuing with incomplete data collection."
echo "Continuing with incomplete data collection."
rm -f $xiin_data_file
echo "/sys data generation failed. No data collected." >> $Debug_Data_Dir/xiin-error.txt
else
echo 'Completed /sys data collection.'
echo -n "$xiin_data" > $xiin_data_file
fi
fi
if [[ -z "$xiin_data" ]];then
download_xiin 'sys'
if [[ $? -eq 0 ]];then
b_run_xiin='true'
b_xiin_downloaded='true'
echo "Running $Xiin_File tool now on /sys..."
echo -n "Using " && python --version
python --version &> $Debug_Data_Dir/python-version.txt
python ./$Xiin_File -d /sys -f $xiin_data_file
if [[ $? -ne 0 ]];then
error=$?
echo -e "ERROR: $Xiin_File exited with error $error - removing data file.\nContinuing with incomplete data collection."
rm -f $xiin_data_file
echo "$Xiin_File data generation failed with python error $error" >> $Debug_Data_Dir/xiin-error.txt
fi
fi
fi
fi
# has to be before gz cleanup
if [[ $B_UPLOAD_DEBUG_DATA == 'true' ]];then
if [[ $b_xiin_downloaded == 'false' ]];then
echo $Line
download_xiin 'upload'
if [[ $? -eq 0 ]];then
b_run_xiin='true'
fi
fi
fi
echo $Line
echo "Creating $SELF_NAME output file now. This can take a few seconds..."
echo "Starting $SELF_NAME from: $start_directory"
cd $start_directory
$SELF_PATH/$SELF_NAME -F${debug_i}Rfrploudmxxx -c 0 -@ 8 -y 120 > $SELF_DATA_DIR/$debug_data_dir/inxi-F${debug_i}Rfrploudmxxxy120.txt
cp $LOG_FILE $SELF_DATA_DIR/$debug_data_dir
if [[ -f $SELF_DATA_DIR/$debug_data_dir.tar.gz ]];then
echo "Found and removing previous tar.gz data file: $debug_data_dir.tar.gz"
rm -f $SELF_DATA_DIR/$debug_data_dir.tar.gz
$SELF_PATH/$SELF_NAME -F${debug_i}Rfrploudmxxx -c 0 -@ 8 -y 120 > $SELF_DATA_DIR/$Debug_Data_Dir/inxi-F${debug_i}Rfrploudmxxxy120.txt
cp $LOG_FILE $SELF_DATA_DIR/$Debug_Data_Dir
if [[ -f $SELF_DATA_DIR/$Debug_Data_Dir.tar.gz ]];then
echo "Found and removing previous tar.gz data file: $Debug_Data_Dir.tar.gz"
rm -f $SELF_DATA_DIR/$Debug_Data_Dir.tar.gz
fi
cd $SELF_DATA_DIR
echo 'Creating tar.gz compressed file of this material now. Contents:'
echo $Line
tar -cvzf $debug_data_dir.tar.gz $debug_data_dir
tar -cvzf $Debug_Data_Dir.tar.gz $Debug_Data_Dir
echo $Line
echo 'Cleaning up leftovers...'
rm -rf $debug_data_dir
rm -rf $Debug_Data_Dir
echo 'Testing gzip file integrity...'
gzip -t $debug_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 $debug_data_dir.tar.gz
echo "Data in gz is corrupted, removed gzip file" >> $debug_data_dir/gzip-error.txt
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:'
completed_gz_file=$SELF_DATA_DIR/$debug_data_dir.tar.gz
completed_gz_file=$SELF_DATA_DIR/$Debug_Data_Dir.tar.gz
echo $completed_gz_file
if [[ $B_UPLOAD_DEBUG_DATA == 'true' ]];then
echo $Line
if [[ $b_run_xiin == 'true' ]];then
echo "Running automatic upload of data to remote server $ftp_upload now..."
python ./$xiin_file --version
python ./$xiin_file -u $completed_gz_file $ftp_upload
python ./$Xiin_File --version
python ./$Xiin_File -u $completed_gz_file $ftp_upload
if [[ $? -gt 0 ]];then
echo $Line
echo "Error: looks like the ftp upload failed. Error number: $?"
echo "The ftp upload failed. Error number: $?" >> $debug_data_dir/xiin-error.txt
# echo "The ftp upload failed. Error number: $?" >> $Debug_Data_Dir/xiin-error.txt
fi
else
echo 'Unable to run the automoatic ftp upload because of an error with the xiin download.'
echo "Unable to run the automoatic ftp upload because of an error with the xiin download" >> $debug_data_dir/xiin-error.txt
echo 'Unable to run the automatic ftp upload because of an error with the xiin download.'
# echo "Unable to run the automoatic ftp upload because of an error with the xiin download" >> $Debug_Data_Dir/xiin-error.txt
fi
else
echo 'You can upload this here using most file managers: ftp.techpatterns.com/incoming'
@ -2278,12 +2313,73 @@ debug_data_collector()
fi
exit 0
}
# $1 - download type [sys|upload]
download_xiin()
{
local xiin_download='' xiin_url="https://github.com/smxi/inxi/raw/xiin/$Xiin_File"
local downloader_error=0 download_type='uploader'
if [[ $1 == 'sys' ]];then
download_type='tree traverse'
fi
touch $Debug_Data_Dir/download_xiin.txt
echo "download_xiin: \$1 - $1" >> $Debug_Data_Dir/download_xiin.txt
echo "Downloading required $download_type tool $Xiin_File..."
if [[ -f xiin && ! -f $Xiin_File ]];then
mv -f xiin $Xiin_File
fi
# -Nc is creating really weird download anomalies, so using -O instead
case $DOWNLOADER in
curl)
xiin_download="$( curl $NO_SSL_OPT -s $xiin_url )" || downloader_error=$?
;;
fetch)
xiin_download="$( fetch $NO_SSL_OPT -q -o - $xiin_url )" || downloader_error=$?
;;
ftp)
xiin_download="$( ftp $NO_SSL_OPT -o - $xiin_url 2>/dev/null )" || downloader_error=$?
;;
wget)
xiin_download="$( wget $NO_SSL_OPT -q -O - $xiin_url )" || downloader_error=$?
;;
no-downloader)
downloader_error=100
;;
esac
# if nothing got downloaded kick out error, otherwise we'll use an older version
if [[ $downloader_error -gt 0 && ! -f $Xiin_File ]];then
echo -e "ERROR: Failed to download required file: $Xiin_File\nMaybe the remote site is down or your networking is broken?"
if [[ $1 == 'sys' ]];then
echo "Continuing with incomplete data collection."
else
echo "$SELF_NAME will be unable to automatically upload the debugger data."
fi
echo "$Xiin_File download failed and no existing $Xiin_File: error: $downloader_error" >> $Debug_Data_Dir/xiin-error.txt
return 1
elif [[ -n $( grep -s '# EOF' <<< "$xiin_download" ) || -f $Xiin_File ]];then
if [[ -n $( grep -s '# EOF' <<< "$xiin_download" ) ]];then
echo "Updating $Xiin_File from remote location"
echo "$xiin_download" > $Xiin_File
else
echo "Using local $Xiin_File due to download failure"
fi
return 0
else
if [[ $1 == 'sys' ]];then
echo -e "ERROR: $Xiin_File downloaded but the program file data is corrupted.\nContinuing with incomplete data collection."
else
echo -e "ERROR: $Xiin_File downloaded but the program file data is corrupted.\nWill not be able to automatically upload debugger data file."
fi
echo "$Xiin_File downloaded but the program file data is corrupted." >> $Debug_Data_Dir/xiin-error.txt
return 2
fi
}
check_recommends_user_output()
{
local Line=$LINE1
local gawk_version='N/A' sed_version='N/A' sudo_version='N/A' python_version='N/A'
local downloaders_bsd=''
local downloaders_bsd='' perl_version='N/A'
if [[ $B_IRC == 'true' ]];then
print_screen_output "Sorry, you can't run this option in an IRC client."
@ -2295,7 +2391,7 @@ check_recommends_user_output()
ftp:ftp-OpenBSD-only~ftp-OpenBSD-only~ftp-OpenBSD-only~:-i_wan_ip;-w/-W;-U/-!_[11-15]_(OpenBSD_only)'
fi
initialize_paths
print_lines_basic "0" "" "$SELF_NAME will now begin checking for the programs it needs to operate. First a check of the main languages and tools $SELF_NAME uses. Python is only for debugging data collection."
print_lines_basic "0" "" "$SELF_NAME will now begin checking for the programs it needs to operate. First a check of the main languages and tools $SELF_NAME uses. Python is only for debugging data uploads unless Perl is missing."
echo $Line
echo "Bash version: $( bash --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^GNU bash/ {print $4}' )"
if type -p gawk &>/dev/null;then
@ -2314,10 +2410,15 @@ check_recommends_user_output()
if type -p python &>/dev/null;then
python_version=$( python --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^Python/ {print $2}' )
fi
# NOTE: does not actually handle 5/6 version, but ok for now
if type -p perl &>/dev/null;then
perl_version=$(perl --version | grep -m 1 -oE 'v[0-9.]+')
fi
echo "Gawk version: $gawk_version"
echo "Sed version: $sed_version"
echo "Sudo version: $sudo_version"
echo "Python version: $python_version"
echo "Perl version: $perl_versio"
echo $Line
echo "Test One: Required System Directories (Linux Only)."
@ -6380,7 +6481,7 @@ get_dmidecode_data()
# To Be Filled By O.E.M.
# strip out starting white space so that the following stuff will clear properly
sub(/^[[:space:]]+/, "", twoData)
sub(/^Base Board .*|^Chassis .*|empty|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*|^0x[0]+$|\[Empty\]|<Bad Index>|^\.\.$/, "", twoData)
sub(/^Base Board .*|^Chassis .*|empty|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*|^0x[0]+$|\[Empty\]|<Bad Index>|Default string|^\.\.$/, "", twoData)
sub(/.*(AssetTagNum|Manufacturer| Or Motherboard|PartNum.*|SerNum).*/, "", twoData)
gsub(/\ybios\y|\yacpi\y/, "", twoData) # note: biostar
sub(/http:\/\/www.abit.com.tw\//, "Abit", twoData)
@ -7758,7 +7859,6 @@ get_kernel_compiler_version()
echo $compiler_version
}
get_kernel_version()
{
eval $LOGFS
@ -7860,7 +7960,7 @@ get_machine_data()
# Chassis Manufacturer|Chassis Version|Chassis Serial Number
# System manufacturer|System Product Name|System Version
# To Be Filled By O.E.M.
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|none|^To be filled.*/, "", $0)
sub(/^Base Board .*|^Chassis .*|.*O\.E\.M\..*|.*OEM.*|^Not .*|^System .*|.*unknow.*|.*N\/A.*|Default string|none|^To be filled.*/, "", $0)
gsub(/\ybios\y|\yacpi\y/, "", $0) # note: biostar
sub(/http:\/\/www.abit.com.tw\//, "Abit", $0)
gsub(/^ +| +$/, "", $0)

View file

@ -1,3 +1,26 @@
=====================================================================================
Version: 2.3.36
Patch Version: 00
Script Date: 2017-08-16
-----------------------------------
Changes:
-----------------------------------
New version, new tarball. This fixes issue #119
The issue was not so much with xiin.py as with some new values in /sys that would
hang tree traverse, however, in order to remove the python dependency (except for
uploading -xx@ debugger data, until I can figure out how to do it with Perl), I
rewrote the tree traverse tool into Perl, which also makes it a lot faster and
easier to work with.
This issue appeared on kernel 4.11 as far as I can tell, some new values in /sys make
the traverse hang if it tries to read the values, **/parameters/** and **/debug/** seem
to be the main culprits, but inxi doesn't need that data anyway for debugging purposes
so it's just excluded.
-----------------------------------
-- Harald Hope - Wed, 16 Aug 2017 00:34:43 -0700
=====================================================================================
Version: 2.3.35
Patch Version: 00