diff options
-rwxr-xr-x | inxi | 228 | ||||
-rw-r--r-- | inxi.changelog | 84 |
2 files changed, 145 insertions, 167 deletions
@@ -2,8 +2,8 @@ ######################################################################## SELF_NAME='inxi' # don't quote the following, parsers grab these too -SELF_VERSION=2.3.40 -SELF_DATE=2017-09-21 +SELF_VERSION=2.3.45 +SELF_DATE=2017-11-21 SELF_PATCH=00 ######################################################################## #### SPECIAL THANKS @@ -311,6 +311,7 @@ B_LABEL_SET='false' B_LSPCI='false' B_LOG_COLORS='false' B_LOG_FULL_DATA='false' +B_MAN='true' B_MAPPER_SET='false' B_OUTPUT_FILTER='false' B_OVERRIDE_FILTER='false' @@ -488,9 +489,6 @@ SELF_DOWNLOAD='https://github.com/smxi/inxi/raw/master/' SELF_DOWNLOAD_BRANCH_1='https://github.com/smxi/inxi/raw/one/' SELF_DOWNLOAD_BRANCH_2='https://github.com/smxi/inxi/raw/two/' SELF_DOWNLOAD_BRANCH_3='https://github.com/smxi/inxi/raw/three/' -SELF_DOWNLOAD_BRANCH_4='https://github.com/smxi/inxi/raw/four/' -SELF_DOWNLOAD_BRANCH_BSD='https://github.com/smxi/inxi/raw/bsd/' -SELF_DOWNLOAD_BRANCH_GNUBSD='https://github.com/smxi/inxi/raw/gnubsd/' SELF_DOWNLOAD_DEV='https://smxi.org/test/' # note, you can use any ip url here as long as it's the only line on the output page. # Also the ip address must be the last thing on that line. If you abuse this ip tool @@ -1658,7 +1656,9 @@ script_self_updater() print_screen_output "To run the new version, just start $SELF_NAME again." print_screen_output "----------------------------------------" print_screen_output "Starting download of man page file now." - if [[ ! -d $man_file_location ]];then + if [[ $B_MAN == 'false' ]];then + print_screen_output "Skipping man download because branch version is being used." + elif [[ ! -d $man_file_location ]];then print_screen_output "The required man directory was not detected on your system, unable to continue: $man_file_location" else if [[ $B_ROOT == 'true' ]];then @@ -1763,23 +1763,21 @@ set_man_location() # args: $1 - debug data type: sys|xorg|disk debug_data_collector() { - local xiin_app='' sys_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 sys_data_file='' error='' Debug_Data_Dir='' bsd_string='' + local xorg_d_files='' xorg_file='' a_distro_ids='' + local completed_gz_file='' ftp_upload='ftp.techpatterns.com/incoming' local Line='-------------------------' local start_directory=$( pwd ) - local host='' debug_i='' root_string='' b_perl_worked='false' b_uploaded='false' + local host='' debug_i='' root_string='' b_traverse_worked='false' b_uploaded='false' if (( "$BASH" >= 4 ));then host="${HOSTNAME,,}" else host=$( tr '[A-Z]' '[a-z]' <<< "$HOSTNAME" ) fi - if [[ $B_DEBUG_I == 'true' ]];then debug_i='i' fi - if [[ -n $host ]];then host=${host// /-} else @@ -1791,9 +1789,7 @@ debug_data_collector() if [[ $( whoami ) == 'root' ]];then root_string='-root' fi - 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 ftp_upload=$ALTERNATE_FTP @@ -1809,7 +1805,6 @@ debug_data_collector() echo 'Deleting previous tar.gz file...' 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" @@ -1854,9 +1849,7 @@ debug_data_collector() # diskinfo -v <disk> # fdisk <disk> dmidecode &> $Debug_Data_Dir/dmidecode.txt - 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}) @@ -2058,7 +2051,6 @@ debug_data_collector() else touch $Debug_Data_Dir/xorg-absent fi - 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 @@ -2174,17 +2166,14 @@ debug_data_collector() fi # create the error file in case it's needed if [[ $B_UPLOAD_DEBUG_DATA == 'true' || $1 == 'disk' || $1 == 'sys' || $1 == 'all' ]];then - touch $SELF_DATA_DIR/$Debug_Data_Dir/xiin-error.txt + touch $SELF_DATA_DIR/$Debug_Data_Dir/sys-dir-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 - sys_data_file=$SELF_DATA_DIR/$Debug_Data_Dir/xiin-sys.txt + sys_data_file=$SELF_DATA_DIR/$Debug_Data_Dir/sys-dir-traverse.txt echo "Getting file paths in /sys..." - ls_sys 1 - ls_sys 2 - ls_sys 3 - ls_sys 4 + sys_tree # note, this generates more lines than the full sys parsing, so only use if required # ls_sys 5 touch $sys_data_file @@ -2195,7 +2184,7 @@ debug_data_collector() use File::Find; use strict; # use warnings; - use 5.010; + use 5.008; my @content = (); find( \&wanted, "/sys"); process_data( @content ); @@ -2210,7 +2199,9 @@ debug_data_collector() 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 + # Must be ascii like. This is questionable and might require further + # investigation, it is removing some characters that we might want + return unless -T; # print $File::Find::name . "\n"; push @content, $File::Find::name; return; @@ -2242,41 +2233,13 @@ debug_data_collector() echo -e "ERROR: failed to generate /sys data - removing data file.\nContinuing with incomplete data collection." echo "Continuing with incomplete data collection." rm -f $sys_data_file - echo "/sys data generation failed. No data collected." >> $Debug_Data_Dir/xiin-error.txt + echo "/sys data generation failed. No data collected." >> $Debug_Data_Dir/sys-dir-error.txt else - b_perl_worked='true' + b_traverse_worked='true' echo 'Completed /sys data collection.' echo -n "$sys_traverse_data" > $sys_data_file fi fi - if [[ -z "$sys_traverse_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 $sys_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 $sys_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' && $b_perl_worked == '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..." @@ -2307,7 +2270,7 @@ debug_data_collector() echo $completed_gz_file if [[ $B_UPLOAD_DEBUG_DATA == 'true' ]];then echo $Line - if [[ $b_perl_worked == 'true' ]];then + if [[ $b_traverse_worked == 'true' ]];then upload_debugger_data "$completed_gz_file" if [[ $? -gt 0 ]];then echo "Error: looks like the Perl ftp upload failed. Error number: $?" @@ -2316,22 +2279,6 @@ debug_data_collector() echo "Hurray! Looks like the Perl ftp upload worked!" fi fi - if [[ $b_uploaded == 'false' ]];then - 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 - if [[ $? -gt 0 ]];then - echo $Line - echo "Error: looks like the Python ftp upload failed. Error number: $?" - # echo "The ftp upload failed. Error number: $?" >> $Debug_Data_Dir/xiin-error.txt - fi - else - echo 'Unable to run the automatic ftp upload because no uploaders appear to be working or available.' - # that has been removed at this point, so no more logging - # echo "Unable to run the automoatic ftp upload because of an error with the xiin download" >> $Debug_Data_Dir/xiin-error.txt - fi - fi else echo 'You can upload this here using most file managers: ftp.techpatterns.com/incoming' echo 'then let a maintainer know it is uploaded.' @@ -2342,7 +2289,21 @@ debug_data_collector() fi exit 0 } -## args: $1 - level +sys_tree() +{ + if type -p tree &>/dev/null;then + tree -a -L 10 /sys > $Debug_Data_Dir/sys-tree-full-10.txt + for branch in $( tree -i -L 1 -d --noreport /sys | grep -v 'sys$' );do + tree -a -L 10 /sys/$branch > $Debug_Data_Dir/sys-tree-$branch-10.txt + done + else + ls_sys 1 + ls_sys 2 + ls_sys 3 + ls_sys 4 + fi +} +## args: $1 - depth ls_sys() { local files='' @@ -2372,7 +2333,7 @@ ls_sys() else if (!/^total / ) { print $0 } - }' &> $Debug_Data_Dir/sys-level-$1.txt + }' &> $Debug_Data_Dir/sys-ls-$1.txt } ## args: $1 - debugger file name @@ -2387,19 +2348,19 @@ upload_debugger_data() echo "Required Perl module Net::FTP not installed." return 3 fi - export debugger_file echo "Starting Perl Uploader..." result="$( perl -e ' use strict; use warnings; + use 5.008; use Net::FTP; my ($ftp, $host, $user, $pass, $dir, $fpath, $error); $host = "ftp.techpatterns.com"; $user = "anonymous"; $pass = "anonymous\@techpatterns.com"; $dir = "incoming"; - $fpath = $ENV{debugger_file}; + $fpath = $ARGV[0]; # NOTE: important: must explicitly set to passive true/1 $ftp = Net::FTP->new($host, Debug => 0, Passive => 1); $ftp->login($user, $pass) || die $ftp->message; @@ -2408,9 +2369,9 @@ upload_debugger_data() print "Connected to FTP server.\n"; $ftp->put($fpath) || die $ftp->message; $ftp->quit; - print "Uploaded file.\n"; + print "Uploaded file $fpath.\n"; print $ftp->message; - ' )" + ' $debugger_file )" echo "$result" if [[ "$result" == *Goodbye* ]];then @@ -2419,67 +2380,6 @@ upload_debugger_data() return 1 fi } -# $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() { @@ -2501,7 +2401,7 @@ check_recommends_user_output() echo $Line echo "Bash version: $( bash --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^GNU bash/ {print $4}' )" if type -p gawk &>/dev/null;then - gawk_version=$( gawk --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^GNU Awk/ {print $3}' ) + gawk_version=$( gawk --version 2>&1 | gawk 'BEGIN {IGNORECASE=1} /^GNU Awk/ {print $3}' ) fi if type -p sed &>/dev/null;then # sed (GNU sed) 4.4 OR GNU sed version 4.4 @@ -2524,7 +2424,7 @@ check_recommends_user_output() echo "Gawk version: $gawk_version" echo "Sed version: $sed_version" echo "Sudo version: $sudo_version" - echo "Python version: $python_version (deprecated)" + echo "Python version: $python_version (legacy, no longer used)" echo "Perl version: $perl_version" echo $Line @@ -2599,7 +2499,7 @@ check_recommends_items() dig:dnsutils~dnsutils~bind-utils:-i_first_wlan_ip_default_test dmidecode:dmidecode~dmidecode~dmidecode~:-M_if_no_sys_machine_data;_-m_memory file:file~file~file~:-o_unmounted_file_system - hciconfig:bluez~bluez-utils~bluez-utils~:-n_-i_bluetooth_data + hciconfig:bluez~bluez-utils~bluez-utils~:-n_-i_bluetooth_data-dev_only-not_used hddtemp:hddtemp~hddtemp~hddtemp~:-Dx_show_hdd_temp ifconfig:net-tools~net-tools~net-tools~:-i_ip_lan-deprecated ip:iproute~iproute2~iproute~:-i_ip_lan @@ -2609,6 +2509,7 @@ check_recommends_items() modinfo:module-init-tools~module-init-tools~module-init-tools~:-Ax,-Nx_module_version runlevel:sysvinit~sysvinit~systemd~:-I_runlevel sudo:sudo~sudo~sudo~:-Dx_hddtemp-user;-o_file-user + tree:tree~tree~tree~:-@1[1-5]_debugger_sys_tree uptime:procps~procps~procps~:-I_uptime_(check_which_package_owns_Debian) ' @@ -3203,32 +3104,28 @@ get_parameters() 3) B_TESTING_1='true' B_TESTING_2='true' ;; - 1[0-6]|http*) + 1[0-3]|http*) if [[ $B_ALLOW_UPDATE == 'true' ]];then case $OPTARG in 10) script_self_updater "$SELF_DOWNLOAD_DEV" 'dev server' "$opt $OPTARG" + B_MAN='false' ;; 11) script_self_updater "$SELF_DOWNLOAD_BRANCH_1" 'branch one server' "$opt $OPTARG" + B_MAN='false' ;; 12) script_self_updater "$SELF_DOWNLOAD_BRANCH_2" 'branch two server' "$opt $OPTARG" + B_MAN='false' ;; 13) script_self_updater "$SELF_DOWNLOAD_BRANCH_3" 'branch three server' "$opt $OPTARG" - ;; - 14) - script_self_updater "$SELF_DOWNLOAD_BRANCH_4" 'branch four server' "$opt $OPTARG" - ;; - 15) - script_self_updater "$SELF_DOWNLOAD_BRANCH_BSD" 'branch bsd server' "$opt $OPTARG" - ;; - 16) - script_self_updater "$SELF_DOWNLOAD_BRANCH_GNUBSD" 'branch gnubsd server' "$opt $OPTARG" + B_MAN='false' ;; http*) script_self_updater "$OPTARG" 'alt server' "$opt <http...>" + B_MAN='false' ;; esac else @@ -3462,9 +3359,6 @@ show_options() print_lines_basic "1" "-! 11" "Triggers an update from source branch one - if present, of course." print_lines_basic "1" "-! 12" "Triggers an update from source branch two - if present, of course." print_lines_basic "1" "-! 13" "Triggers an update from source branch three - if present, of course." - print_lines_basic "1" "-! 14" "Triggers an update from source branch four - if present, of course." - print_lines_basic "1" "-! 15" "Triggers an update from source branch BSD - if present, of course." - print_lines_basic "1" "-! 16" "Triggers an update from source branch GNUBSD - if present, of course." print_lines_basic "1" "-! " "<http://......> Triggers an update from whatever server you list." print_lines_basic "1" "" "Example: inxi^-!^http://yourserver.com/testing/inxi" fi @@ -7339,17 +7233,17 @@ get_hdd_data_basic() fi if swapctl -l -k &>/dev/null;then swap_size=$( swapctl -l -k 2>/dev/null | gawk ' - BEGIN { - swapSize=0 - total=0 - } - ( $1 ~ /^\/dev/ ) && ( $2 ~ /^[0-9]+$/ ) { - total += $2 - } - END { - # result in blocks already - print total - }' ) +BEGIN { +swapSize=0 +total=0 +} +( $1 ~ /^\/dev/ ) && ( $2 ~ /^[0-9]+$/ ) { + total += $2 +} +END { + # result in blocks already + print total +}' ) fi fi # echo ss: $swap_size diff --git a/inxi.changelog b/inxi.changelog index 67dcddc..afd0aea 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,4 +1,88 @@ ===================================================================================== +Version: 2.3.45 +Patch Version: 00 +Script Date: 2017-11-21 +----------------------------------- +Changes: +----------------------------------- +New version, new tarball. Because it's kind of hard to read the per /sys sub +directory output, I split it into sections, and also have the full /sys tree +in case there are some subtle differences in how the paths interlink. + +----------------------------------- +-- Harald Hope - Tue, 21 Nov 2017 11:26:51 -0800 + +===================================================================================== +Version: 2.3.44 +Patch Version: 00 +Script Date: 2017-11-21 +----------------------------------- +Changes: +----------------------------------- + +New version, new tarball. Added some critical debugger tools for ongoing issue # 128 +ARM data collection in /sys. + +Using 'tree' now instead of ls if it is installed for debugger /sys tree listing. +Added to recommends. Updated bluetooth recommends to note it's dev only. That +should fix issue #127 + +----------------------------------- +-- Harald Hope - Tue, 21 Nov 2017 10:35:34 -0800 + +===================================================================================== +Version: 2.3.43 +Patch Version: 00 +Script Date: 2017-10-31 +----------------------------------- +Changes: +----------------------------------- +New version, tarball. Small perl fix, nothing changes in output or function. + +----------------------------------- +-- Harald Hope - Tue, 31 Oct 2017 17:30:03 -0700 + +===================================================================================== +Version: 2.3.42 +Patch Version: 00 +Script Date: 2017-10-30 +----------------------------------- +Changes: +----------------------------------- +Removed xiin references, fully switched to perl sys traverse tool and uploader. + +Renamed debugger sys files to sys-dir-[traverse|depth-[1-6]].txt + +----------------------------------- +-- Harald Hope - Mon, 30 Oct 2017 12:04:02 -0700 + +===================================================================================== +Version: 2.3.41 +Patch Version: 00 +Script Date: 2017-10-29 +----------------------------------- +Changes: +----------------------------------- +New version, new tarball. Updated the inxi upater options, removed some legacy +branches, simplified the options. This corresponds to updates on github where +I'm finally bringing the alternate location self updater back into operational +state after a long dormant period. + +Also, and this may be of interest to some maintainers, please note, there is +a new branch: master-plain which does NOT have the gz files inxi.1.gz and +inxi.tar.gz + +If you want to avoid the big clones, you can use that branch with this command: +git clone https://github.com/smxi/inxi --branch master-plain --single-branch + +And that should only track the basic 3 files: inxi inxi.1 and inxi.changelog + +This fixes issue #94 + +----------------------------------- +-- Harald Hope - Sun, 29 Oct 2017 09:47:28 -0700 + +===================================================================================== Version: 2.3.40 Patch Version: 00 Script Date: 2017-09-21 |