diff --git a/inxi b/inxi index ece0fcd..f9d012d 100644 --- a/inxi +++ b/inxi @@ -1,9 +1,9 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.1.27 -#### Date: 2014-05-02 -#### Patch Number: 00 +#### Version: 2.1.29 +#### Date: 2014-08-11 +#### Patch Number: 01-b3 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -1575,7 +1575,7 @@ 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 Line='-------------------------' + local Line='-------------------------' root_string='' local start_directory=$( pwd ) local host=$( tr '[A-Z]' '[a-z]' <<< "$HOSTNAME" ) if [[ -n $host ]];then @@ -1586,8 +1586,11 @@ debug_data_collector() if [[ -n $BSD_TYPE ]];then bsd_string="-$BSD_TYPE" fi + if [[ $( whoami ) == 'root' ]];then + root_string='-root' + fi - debug_data_dir="inxi$bsd_string-$host-$(date +%Y%m%d-%H%M%S)-$1" + 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 @@ -1669,6 +1672,8 @@ debug_data_collector() ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt gcc --version &> $debug_data_dir/gcc-version.txt clang --version &> $debug_data_dir/clang-version.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 @@ -1827,7 +1832,7 @@ debug_data_collector() echo 'Creating inxi output file now. This can take a few seconds...' echo "Starting $SCRIPT_NAME from: $start_directory" cd $start_directory - $SCRIPT_PATH/$SCRIPT_NAME -FRfrploudxxx -c 0 -@ 8 -y 120 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRfrploudxxxy120.txt + $SCRIPT_PATH/$SCRIPT_NAME -FRfrploudixxx -c 0 -@ 8 -y 120 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRfrploudixxxy120.txt cp $LOG_FILE $SCRIPT_DATA_DIR/$debug_data_dir if [[ -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz ]];then echo "Found and removing previous tar.gz data file: $debug_data_dir.tar.gz" @@ -3462,7 +3467,7 @@ get_audio_data() else if (/kernel modules:/) { modules[audioCard] = modules[audioCard] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) "" } - else if (/I\/O/) { + else if (/^[[:space:]]*I\/O/) { portsTemp = gensub(/\t*I\/O ports at (.*) \[.*\]/,"\\1","g",$0) ports[audioCard] = ports[audioCard] portsTemp " " } @@ -4165,7 +4170,7 @@ get_desktop_environment() eval $LOGFS # set the default, this function only runs in X, if null, don't print data out - local desktop_environment='' xprop_root='' + local desktop_environment='' xprop_root='' version2='' local version='' version_data='' toolkit='' # works on 4, assume 5 will id the same, why not, no need to update in future @@ -4251,7 +4256,7 @@ get_desktop_environment() desktop_environment="MATE" # note, GNOME_DESKTOP_SESSION_ID is deprecated so we'll see how that works out # https://bugzilla.gnome.org/show_bug.cgi?id=542880 - elif [[ -n $GNOME_DESKTOP_SESSION_ID ]]; then + elif [[ -n $GNOME_DESKTOP_SESSION_ID || $XDG_CURRENT_DESKTOP == 'GNOME' ]]; then if type -p gnome-shell &>/dev/null;then version=$( get_program_version 'gnome-shell' 'gnome' '3' ) elif type -p gnome-about &>/dev/null;then @@ -4315,18 +4320,25 @@ get_desktop_environment() # note: openbox-lxde --version may be present, but returns openbox data version=$( get_program_version 'openbox' '^openbox' '2' ) if [[ $XDG_CURRENT_DESKTOP == 'LXDE' || \ - -n $( grep -is 'lxde' <<< "$Ps_aux_Data" ) ]];then + -n $( grep -is '/lxsession' <<< "$Ps_aux_Data" ) ]];then if [[ -n $version ]];then version="(Openbox $version)" fi desktop_environment='LXDE' - elif [[ -n $( grep -is 'razor-desktop' <<< "$Ps_aux_Data" ) ]];then + elif [[ $XDG_CURRENT_DESKTOP == 'Razor' || $XDG_CURRENT_DESKTOP == 'LXQt' ]] || \ + [[ -n $( grep -Eis '(razor-desktop|lxqt-session)' <<< "$Ps_aux_Data" ) ]];then + if [[ -n $( grep -is 'lxqt-session' <<< "$Ps_aux_Data" ) ]];then + desktop_environment='LXQt' + elif [[ -n $( grep -is 'razor-desktop' <<< "$Ps_aux_Data" ) ]];then + desktop_environment='Razor-Qt' + else + desktop_environment='LX-Qt-Variant' + fi if [[ -n $version ]];then version="(Openbox $version)" fi - desktop_environment='Razor-QT' else - desktop_environment='Openbox' + desktop_environment='Openbox' fi elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then version=$( get_program_version 'icewm' '^icewm' '2' ) @@ -4880,9 +4892,9 @@ get_dmidecode_data() # note stripping out these lines: Handle 0x0016, DMI type 17, 27 bytes # but NOT deleting them, in case the dmidecode data is missing empty lines which will be # used to separate results. Then we remove the doubled empty lines to keep it clean and - # strip out all the stuff we don't want to see in the results. - DMIDECODE_DATA="$( $dmidecodePath 2>/dev/null \ - | gawk -F ':' ' + # strip out all the stuff we don't want to see in the results. We want the error data in + # stdout for error handling + DMIDECODE_DATA="$( $dmidecodePath 2>&1 | gawk -F ':' ' BEGIN { IGNORECASE=1 cutExtraTab="false" @@ -4946,9 +4958,18 @@ N /^\n$/D }' \ )" + log_function_data "DMIDECODE_DATA (PRE): $DMIDECODE_DATA" + if [[ ${#DMIDECODE_DATA} -lt 60 ]];then + if [[ -z ${DMIDECODE_DATA/*Permission denied*/} ]];then + DMIDECODE_DATA='dmidecode-error-requires-root' + # this handles very old systems, like Lenny 2.6.26, with dmidecode, but no data + elif [[ -n $( grep -i 'no smbios ' <<< "$DMIDECODE_DATA" ) ]];then + DMIDECODE_DATA='dmidecode-error-no-smbios-dmi-data' + fi + fi fi B_DMIDECODE_SET='true' - log_function_data "DMIDECODE_DATA: $DMIDECODE_DATA" + log_function_data "DMIDECODE_DATA (POST): $DMIDECODE_DATA" fi eval $LOGFE @@ -6099,112 +6120,107 @@ get_machine_data() else get_dmidecode_data if [[ -n $DMIDECODE_DATA ]];then - if [[ $B_ROOT == 'true' ]];then - # this handles very old systems, like Lenny 2.6.26, with dmidecode, but no data - if [[ -n $( grep -i 'no smbios ' <<< "$DMIDECODE_DATA" ) ]];then - array_string='dmidecode-no-smbios-dmi-data' - # please note: only dmidecode version 2.11 or newer supports consistently the -s flag - else - array_string=$( gawk -F ':' ' - BEGIN { - IGNORECASE=1 - baseboardManufacturer="" - baseboardProductName="" - baseboardSerialNumber="" - baseboardVersion="" - biosReleaseDate="" - biosRevision="" # only available from dmidecode - biosRomSize="" # only available from dmidecode - biosVendor="" - biosVersion="" - chassisManufacturer="" - chassisSerialNumber="" - chassisType="" - chassisVersion="" - systemManufacturer="" - systemProductName="" - systemVersion="" - systemSerialNumber="" - systemUuid="" - bItemFound="" # we will only output if at least one item was found - fullString="" - testString="" - bSys="" - bCha="" - bBio="" - bBas="" - } - /^Bios Information/ { - while ( getline && !/^$/ ) { - if ( $1 ~ /^Release Date/ ) { biosReleaseDate=$2 } - if ( $1 ~ /^BIOS Revision/ ) { biosRevision=$2 } - if ( $1 ~ /^ROM Size/ ) { biosRomSize=$2 } - if ( $1 ~ /^Vendor/ ) { biosVendor=$2 } - if ( $1 ~ /^Version/ ) { biosVersion=$2 } - } - testString=biosReleaseDate biosRevision biosRomSize biosVendor biosVersion - if ( testString != "" ) { - bItemFound="true" - } - bBio="true" - } - /^Base Board Information/ { - while ( getline && !/^$/ ) { - if ( $1 ~ /^Manufacturer/ ) { baseboardManufacturer=$2 } - if ( $1 ~ /^Product Name/ ) { baseboardProductName=$2 } - if ( $1 ~ /^Serial Number/ ) { baseboardSerialNumber=$2 } - } - testString=baseboardManufacturer baseboardProductName baseboardSerialNumber - if ( testString != "" ) { - bItemFound="true" - } - bBas="true" - } - /^Chassis Information/ { - while ( getline && !/^$/ ) { - if ( $1 ~ /^Manufacturer/ ) { chassisManufacturer=$2 } - if ( $1 ~ /^Serial Number/ ) { chassisSerialNumber=$2 } - if ( $1 ~ /^Type/ ) { chassisType=$2 } - if ( $1 ~ /^Version/ ) { chassisVersion=$2 } - } - testString=chassisManufacturer chassisSerialNumber chassisType chassisVersion - if ( testString != "" ) { - bItemFound="true" - } - bCha="true" - } - /^System Information/ { - while ( getline && !/^$/ ) { - if ( $1 ~ /^Manufacturer/ ) { systemManufacturer=$2 } - if ( $1 ~ /^Product Name/ ) { systemProductName=$2 } - if ( $1 ~ /^Version/ ) { systemVersion=$2 } - if ( $1 ~ /^Serial Number/ ) { systemSerialNumber=$2 } - if ( $1 ~ /^UUID/ ) { systemUuid=$2 } - } - testString=systemManufacturer systemProductName systemVersion systemSerialNumber systemUuid - if ( testString != "" ) { - bItemFound="true" - } - bSys="true" - } - ( bSys == "true" && bCha="true" && bBio == "true" && bBas == "true" ) { - exit # stop the loop - } - END { - if ( bItemFound == "true" ) { - fullString = systemManufacturer "," systemProductName "," systemVersion "," systemSerialNumber - fullString = fullString "," systemUuid "," baseboardManufacturer "," baseboardProductName - fullString = fullString "," baseboardVersion "," baseboardSerialNumber "," biosVendor - fullString = fullString "," biosVersion "," biosReleaseDate "," chassisManufacturer - fullString = fullString "," chassisType "," chassisVersion "," chassisSerialNumber - fullString = fullString "," biosRevision "," biosRomSize - - print fullString - } - }' <<< "$DMIDECODE_DATA" ) - fi + if [[ $DMIDECODE_DATA == 'dmidecode-error-'* ]];then + array_string=$DMIDECODE_DATA + # please note: only dmidecode version 2.11 or newer supports consistently the -s flag else - array_string='dmidecode-non-root-user' + array_string=$( gawk -F ':' ' + BEGIN { + IGNORECASE=1 + baseboardManufacturer="" + baseboardProductName="" + baseboardSerialNumber="" + baseboardVersion="" + biosReleaseDate="" + biosRevision="" # only available from dmidecode + biosRomSize="" # only available from dmidecode + biosVendor="" + biosVersion="" + chassisManufacturer="" + chassisSerialNumber="" + chassisType="" + chassisVersion="" + systemManufacturer="" + systemProductName="" + systemVersion="" + systemSerialNumber="" + systemUuid="" + bItemFound="" # we will only output if at least one item was found + fullString="" + testString="" + bSys="" + bCha="" + bBio="" + bBas="" + } + /^Bios Information/ { + while ( getline && !/^$/ ) { + if ( $1 ~ /^Release Date/ ) { biosReleaseDate=$2 } + if ( $1 ~ /^BIOS Revision/ ) { biosRevision=$2 } + if ( $1 ~ /^ROM Size/ ) { biosRomSize=$2 } + if ( $1 ~ /^Vendor/ ) { biosVendor=$2 } + if ( $1 ~ /^Version/ ) { biosVersion=$2 } + } + testString=biosReleaseDate biosRevision biosRomSize biosVendor biosVersion + if ( testString != "" ) { + bItemFound="true" + } + bBio="true" + } + /^Base Board Information/ { + while ( getline && !/^$/ ) { + if ( $1 ~ /^Manufacturer/ ) { baseboardManufacturer=$2 } + if ( $1 ~ /^Product Name/ ) { baseboardProductName=$2 } + if ( $1 ~ /^Serial Number/ ) { baseboardSerialNumber=$2 } + } + testString=baseboardManufacturer baseboardProductName baseboardSerialNumber + if ( testString != "" ) { + bItemFound="true" + } + bBas="true" + } + /^Chassis Information/ { + while ( getline && !/^$/ ) { + if ( $1 ~ /^Manufacturer/ ) { chassisManufacturer=$2 } + if ( $1 ~ /^Serial Number/ ) { chassisSerialNumber=$2 } + if ( $1 ~ /^Type/ ) { chassisType=$2 } + if ( $1 ~ /^Version/ ) { chassisVersion=$2 } + } + testString=chassisManufacturer chassisSerialNumber chassisType chassisVersion + if ( testString != "" ) { + bItemFound="true" + } + bCha="true" + } + /^System Information/ { + while ( getline && !/^$/ ) { + if ( $1 ~ /^Manufacturer/ ) { systemManufacturer=$2 } + if ( $1 ~ /^Product Name/ ) { systemProductName=$2 } + if ( $1 ~ /^Version/ ) { systemVersion=$2 } + if ( $1 ~ /^Serial Number/ ) { systemSerialNumber=$2 } + if ( $1 ~ /^UUID/ ) { systemUuid=$2 } + } + testString=systemManufacturer systemProductName systemVersion systemSerialNumber systemUuid + if ( testString != "" ) { + bItemFound="true" + } + bSys="true" + } + ( bSys == "true" && bCha="true" && bBio == "true" && bBas == "true" ) { + exit # stop the loop + } + END { + if ( bItemFound == "true" ) { + fullString = systemManufacturer "," systemProductName "," systemVersion "," systemSerialNumber + fullString = fullString "," systemUuid "," baseboardManufacturer "," baseboardProductName + fullString = fullString "," baseboardVersion "," baseboardSerialNumber "," biosVendor + fullString = fullString "," biosVersion "," biosReleaseDate "," chassisManufacturer + fullString = fullString "," chassisType "," chassisVersion "," chassisSerialNumber + fullString = fullString "," biosRevision "," biosRomSize + + print fullString + } + }' <<< "$DMIDECODE_DATA" ) fi fi fi @@ -6309,6 +6325,7 @@ get_module_version_number() eval $LOGFE } + ## create array of network cards get_networking_data() { @@ -6319,72 +6336,64 @@ get_networking_data() IFS=$'\n' A_NETWORK_DATA=( $( echo "$Lspci_v_Data" | gawk ' + # NOTE: see version 2.1.28 or earlier for old logic if for some reason it is needed again + # that used a modified string made from nic name for index, why, I have no idea, makes no sense and leads + # to wrong ordered output as well. get_audio_data uses the old logic for now too. BEGIN { IGNORECASE=1 - counter=0 # required to handle cases of > 1 instance of the same chipset + counter=0 } - /^[0-9a-f:\.]+ (ethernet|network) (controller|bridge)/ || /^[0-9a-f:\.]+ [^:]+: .*(ethernet|network).*$/ { - nic=gensub(/^[0-9a-f:\.]+ [^:]+: (.+)$/,"\\1","g",$0) - #gsub(/realtek semiconductor/, "Realtek", nic) - #gsub(/davicom semiconductor/, "Davicom", nic) + /^[0-9a-f:\.]+ ((ethernet|network) (controller|bridge)|infiniband)/ || /^[0-9a-f:\.]+ [^:]+: .*(ethernet|infiniband|network).*$/ { + aNic[counter]=gensub(/^[0-9a-f:\.]+ [^:]+: (.+)$/,"\\1","g",$0) + #gsub(/realtek semiconductor/, "Realtek", aNic[counter]) + #gsub(/davicom semiconductor/, "Davicom", aNic[counter]) # The doublequotes are necessary because of the pipes in the variable. - gsub(/'"$BAN_LIST_NORMAL"'/, "", nic) - gsub(/,/, " ", nic) - gsub(/^ +| +$/, "", nic) - gsub(/ [ \t]+/, " ", nic) - # construct a unique string ending for each chipset detected, this allows for - # multiple instances of the same exact chipsets, ie, dual gigabit - nic = nic "~~" counter++ - aPciBusId[nic] = gensub(/(^[0-9a-f:\.]+) [^:]+: .+$/,"\\1","g",$0) - # I do not understand why incrementing a string index makes sense? - eth[nic]++ + gsub(/'"$BAN_LIST_NORMAL"'/, "", aNic[counter]) + gsub(/,/, " ", aNic[counter]) + gsub(/^ +| +$/, "", aNic[counter]) + gsub(/ [ \t]+/, " ", aNic[counter]) + aPciBusId[counter] = gensub(/(^[0-9a-f:\.]+) [^:]+: .+$/,"\\1","g",$0) while ( getline && !/^$/ ) { gsub(/,/, "", $0) - if ( /I\/O/ ) { - ports[nic] = ports[nic] $4 " " + if ( /^[[:space:]]*I\/O/ ) { + aPorts[counter] = aPorts[counter] $4 " " } if ( /driver in use/ ) { - drivers[nic] = drivers[nic] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) "" + aDrivers[counter] = aDrivers[counter] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) "" } else if ( /kernel modules/ ) { - modules[nic] = modules[nic] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) "" + aModules[counter] = aModules[counter] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) "" } } + counter++ } - END { - j=0 - for (i in eth) { + for (i=0;i 1 ) { - a[j] = eth[i] "x " i - } - else { - a[j] = i - } ## note: this loses the plural ports case, is it needed anyway? - if ( ports[i] != "" ) { - usePorts = ports[i] + if ( aPorts[i] != "" ) { + usePorts = aPorts[i] } - if ( drivers[i] != "" ) { - useDrivers = drivers[i] + if ( aDrivers[i] != "" ) { + useDrivers = aDrivers[i] } - if ( modules[i] != "" ) { - useModules = modules[i] + if ( aModules[i] != "" ) { + useModules = aModules[i] + } + if ( aNic[i] != "" ) { + useNic=aNic[i] } if ( aPciBusId[i] != "" ) { usePciBusId = aPciBusId[i] } # create array primary item for master array - # and strip out the counter again, this handled dual cards with same chipset - sub( /~~[0-9]+$/, "", a[j] ) sub( / $/, "", usePorts ) # clean off trailing whitespace - print a[j] "," useDrivers "," usePorts "," useModules, "," usePciBusId - j++ + print useNic "," useDrivers "," usePorts "," useModules, "," usePciBusId } }' ) ) IFS="$ORIGINAL_IFS" @@ -6401,42 +6410,59 @@ get_networking_data() get_network_advanced_data() { eval $LOGFS - local a_network_adv_working='' if_path='' working_path='' working_uevent_path='' dir_path='' - local if_id='' speed='' duplex='' mac_id='' oper_state='' chip_id='' - local usb_data='' usb_vendor='' usb_product='' product_path='' driver_test='' + local a_network_adv_working='' if_data='' working_path='' working_uevent_path='' dir_path='' + local if_id='' speed='' duplex='' mac_id='' oper_state='' chip_id='' b_path_made='true' + local usb_data='' usb_vendor='' usb_product='' product_path='' driver_test='' array_counter=0 + local full_path='' + # we need to change to holder since we are updating the main array + IFS=$'\n' + local a_main_working=(${A_NETWORK_DATA[@]}) + IFS="$ORIGINAL_IFS" - for (( i=0; i < ${#A_NETWORK_DATA[@]}; i++ )) + for (( i=0; i < ${#a_main_working[@]}; i++ )) do IFS="," - a_network_adv_working=( ${A_NETWORK_DATA[i]} ) + a_network_adv_working=( ${a_main_working[i]} ) + IFS="$ORIGINAL_IFS" # reset these every go round driver_test='' - if_id='' - speed='' - duplex='' - mac_id='' - oper_state='' + if_data='' + product_path='' usb_data='' - chip_id='' + usb_product='' + usb_vendor='' + working_path='' + working_uevent_path='' if [[ -z $( grep '^usb-' <<< ${a_network_adv_working[4]} ) ]];then # note although this may exist technically don't use it, it's a virtual path # and causes weird cat errors when there's a missing file as well as a virtual path # /sys/bus/pci/devices/0000:02:02.0/net/eth1 # real paths are: /sys/devices/pci0000:00/0000:00:1e/0/0000:02:02.0/net/eth1/uevent # and on older debian kernels: /sys/devices/pci0000:00/0000:02:02.0/net:eth1/uevent - # but broadcom shows this sometimes: + # but broadcom shows this sometimes, and older kernels maybe: + # /sys/devices/pci0000:00/0000:00:01.0/0000:05:00.0/net/eth0/ # /sys/devices/pci0000:00/0000:00:03.0/0000:03:00.0/ssb0:0/uevent:['DRIVER=b43', 'MODALIAS=ssb:v4243id0812rev0D']: - working_path="/sys/bus/pci/devices/0000:${a_network_adv_working[4]}" + # echo a ${a_network_adv_working[4]} + if [[ -d /sys/bus/pci/devices/ ]];then + working_path="/sys/bus/pci/devices/0000:${a_network_adv_working[4]}" + elif [[ -d /sys/devices/pci0000:00/ ]];then + working_path="/sys/devices/pci0000:00/0000:00:01.0/0000:${a_network_adv_working[4]}" + fi + #echo wp ${a_network_adv_working[4]} $i # now we want the real one, that xiin also displays, without symbolic links. - if [[ -e $working_path ]];then + if [[ -n $working_path && -e $working_path ]];then working_path=$( readlink -f $working_path 2>/dev/null ) - # sometimes there is another directory between the path and /net - if [[ ! -e $working_path/net ]];then - # using find here, probably will need to also use it in usb part since the grep - # method seems to not be working now. Slice off the rest, which leaves the basic path - working_path=$( find $working_path/*/net/*/uevent 2>/dev/null | \ - sed 's|/net.*||' ) - fi + else + working_path=$( find -P /sys/ -type d -name "*:${a_network_adv_working[4]}" 2>/dev/null ) + # just on off chance we get two returns, just one one + working_path=${working_path%% *} + fi + # sometimes there is another directory between the path and /net + if [[ -n $working_path && ! -e $working_path/net ]];then + # using find here, probably will need to also use it in usb part since the grep + # method seems to not be working now. Slice off the rest, which leaves the basic path + working_path=$( find $working_path/*/net/*/uevent 2>/dev/null | \ + sed 's|/net.*||' ) fi # working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent ) else @@ -6459,7 +6485,6 @@ get_network_advanced_data() product_path=$( grep -s "$usb_product" /sys/devices/pci*/*/usb*/*/*/idProduct | \ sed -e "s/idProduct:$usb_product//" -e '/driver/d' ) fi - # make sure it's the right product/vendor match here, it will almost always be but let's be sure if [[ -n $working_path && -n $product_path ]] && [[ $working_path == $product_path ]];then #if [[ -n $working_path ]];then @@ -6477,50 +6502,90 @@ get_network_advanced_data() a_network_adv_working[1]=$driver_test fi fi + #echo wp: $working_path log_function_data "PRE: working_path: $working_path\nworking_uevent_path: $working_uevent_path" - # this applies in two different cases, one, default, standard, two, for usb, this is actually # the short path, minus the last longer numeric directory name, ie: # from debian squeeze 2.6.32-5-686: # /sys/devices/pci0000:00/0000:00:0b.1/usb1/1-1/net/wlan0/address if [[ -e $working_path/net ]];then - if_path=$( ls $working_path/net 2>/dev/null ) - if_id=$if_path - working_path=$working_path/net/$if_path + # in cases like infiniband dual port devices, there can be two ids, like ib0 ib1, + # with line break in output + if_data=$( ls $working_path/net 2>/dev/null ) + b_path_made='false' # this is the normal usb detection if the first one didn't work elif [[ -n $usb_data && -e $working_uevent_path/net ]];then - if_path=$( ls $working_uevent_path/net 2>/dev/null ) - if_id=$if_path - working_path=$working_uevent_path/net/$if_path + if_data=$( ls $working_uevent_path/net 2>/dev/null ) + working_path=$working_uevent_path/net/$if_data # 2.6.32 debian lenny kernel shows not: /net/eth0 but /net:eth0 - else - if_path=$( ls $working_path 2>/dev/null | grep 'net:' ) - if_id=$( cut -d ':' -f 2 <<< "$if_path" ) - working_path=$working_path/$if_path - fi - log_function_data "POST: working_path: $working_path\nif_path: $if_path - if_id: $if_id" - - if [[ -n $if_path ]];then - if [[ -r $working_path/speed ]];then - speed=$( cat $working_path/speed 2>/dev/null ) - fi - if [[ -r $working_path/duplex ]];then - duplex=$( cat $working_path/duplex 2>/dev/null ) - fi - if [[ -r $working_path/address ]];then - mac_id=$( cat $working_path/address 2>/dev/null ) - fi - if [[ -r $working_path/operstate ]];then - oper_state=$( cat $working_path/operstate 2>/dev/null ) + elif [[ -n ${working_path/\/sys*/} ]];then + if_data=$( ls $working_path 2>/dev/null | grep 'net:' ) + if [[ -n $if_data ]];then + working_path=$working_path/$if_data + # we won't be using this for path any more, just the actual if id output + # so prep it for the loop below + if_data=$( cut -d ':' -f 2 <<< "$if_data" ) fi fi - - if [[ -n ${a_network_adv_working[10]} ]];then - chip_id=${a_network_adv_working[10]} + # just in case we got a failed path, like /net or /, clear it out for tests below + if [[ -n ${working_path/\/sys*/} ]];then + working_path='' fi - A_NETWORK_DATA[i]=${a_network_adv_working[0]}","${a_network_adv_working[1]}","${a_network_adv_working[2]}","${a_network_adv_working[3]}","${a_network_adv_working[4]}","$if_id","$oper_state","$speed","$duplex","$mac_id","$chip_id - IFS="$ORIGINAL_IFS" + #echo id: $if_data + log_function_data "POST: working_path: $working_path\nif_data: $if_data - if_id: $if_id" + # there are virtual devices that will have no if data but which we still want in the array + # as it loops. These will also have null working_path as well since no **/net is found + # echo if_data: $if_data + if [[ -z $if_data ]];then + if_data='null-if-id' + fi + ## note: in cases of dual ports with different ids, this loop will create extra array items + for if_item in $if_data + do + chip_id= + duplex='' + full_path='' + if_id='' + mac_id='' + oper_state='' + speed='' + # strip out trailing spaces + if_item=${if_item%% } + #echo wp1: $working_path + if [[ $working_path != '' ]];then + if_id=$if_item + if [[ $b_path_made == 'false' ]];then + full_path=$working_path/net/$if_item + else + full_path=$working_path + fi + if [[ -r $full_path/speed ]];then + speed=$( cat $full_path/speed 2>/dev/null ) + fi + if [[ -r $full_path/duplex ]];then + duplex=$( cat $full_path/duplex 2>/dev/null ) + fi + if [[ -r $full_path/address ]];then + mac_id=$( cat $full_path/address 2>/dev/null ) + fi + if [[ -r $full_path/operstate ]];then + oper_state=$( cat $full_path/operstate 2>/dev/null ) + fi + if [[ -n ${a_network_adv_working[10]} ]];then + chip_id=${a_network_adv_working[10]} + fi + fi + + #echo fp: $full_path + #echo id: $if_id + # echo "$if_data ii: $if_item $array_counter i: $i" + A_NETWORK_DATA[$array_counter]=${a_network_adv_working[0]}","${a_network_adv_working[1]}","${a_network_adv_working[2]}","${a_network_adv_working[3]}","${a_network_adv_working[4]}","$if_id","$oper_state","$speed","$duplex","$mac_id","$chip_id + + ((array_counter++)) + done done + a_temp=${A_NETWORK_DATA[@]} + log_function_data "A_NETWORK_DATA (advanced): $a_temp" eval $LOGFE } @@ -6597,7 +6662,7 @@ get_networking_wan_ip_data() # awk has bad regex handling so checking it with grep -E instead # ip=$( echo 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | gawk --re-interval ' # ip=$( wget -q -O - $WAN_IP_URL | gawk --re-interval ' - ip=$( wget -t 1 -T $WGET_TIMEOUT -q -O - $WAN_IP_URL | gawk --re-interval ' + ip=$( wget -t 4 -T $WGET_TIMEOUT -q -O - $WAN_IP_URL | gawk --re-interval ' { #gsub("\n","",$2") print $NF @@ -10320,7 +10385,7 @@ print_info_data() if [[ $shell_parent == 'login' ]];then shell_parent='' elif [[ -n $shell_parent ]];then - shell_parent=" running in $shell_parent" + shell_parent=" running in ${shell_parent##*/}" fi fi IRC_CLIENT="$IRC_CLIENT ($shell_data$shell_parent)" @@ -10561,11 +10626,10 @@ print_machine_data() system_line="${C2}$sysDmiNull" fi # patch to dump all of above if dmidecode was data source and non root user - if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' || \ - ${A_MACHINE_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then - if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' ]];then + if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-error-'* ]];then + if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-error-requires-root' ]];then system_line="${C2}${sysDmiError}dmidecode: you must be root to run dmidecode" - elif [[ ${A_MACHINE_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then + elif [[ ${A_MACHINE_DATA[0]} == 'dmidecode-error-no-smbios-dmi-data' ]];then system_line="${C2}${sysDmiError}dmidecode: no machine data available" fi mobo_line='' @@ -10598,11 +10662,10 @@ print_memory_data() memory_line=$( create_print_line "Memory:" "$memory_line${CN}" ) print_screen_output "$memory_line" - if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-non-root-user' || \ - ${A_MEMORY_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then - if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-non-root-user' ]];then + if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-'* ]];then + if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-requires-root' ]];then memory_line="${C2}${sysDmiError}dmidecode: you must be root to run dmidecode" - elif [[ ${A_MEMORY_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then + elif [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-no-smbios-dmi-data' ]];then memory_line="${C2}${sysDmiError}dmidecode: no machine data available" fi fi