mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
branch three, dmidecode cleanup
This commit is contained in:
parent
6ae2e5d7ce
commit
f965cfc3ff
285
inxi
285
inxi
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 2.1.27
|
#### Version: 2.1.29
|
||||||
#### Date: 2014-05-02
|
#### Date: 2014-08-11
|
||||||
#### Patch Number: 00
|
#### Patch Number: 01-b3
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -1575,7 +1575,7 @@ debug_data_collector()
|
||||||
local xiin_app='' xiin_data_file='' xiin_download='' error='' b_run_xiin='false'
|
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 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 completed_gz_file='' xiin_file='xiin.py' ftp_upload='ftp.techpatterns.com/incoming'
|
||||||
local Line='-------------------------'
|
local Line='-------------------------' root_string=''
|
||||||
local start_directory=$( pwd )
|
local start_directory=$( pwd )
|
||||||
local host=$( tr '[A-Z]' '[a-z]' <<< "$HOSTNAME" )
|
local host=$( tr '[A-Z]' '[a-z]' <<< "$HOSTNAME" )
|
||||||
if [[ -n $host ]];then
|
if [[ -n $host ]];then
|
||||||
|
@ -1586,8 +1586,11 @@ debug_data_collector()
|
||||||
if [[ -n $BSD_TYPE ]];then
|
if [[ -n $BSD_TYPE ]];then
|
||||||
bsd_string="-$BSD_TYPE"
|
bsd_string="-$BSD_TYPE"
|
||||||
fi
|
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 [[ $B_IRC == 'false' ]];then
|
||||||
if [[ -n $ALTERNATE_FTP ]];then
|
if [[ -n $ALTERNATE_FTP ]];then
|
||||||
|
@ -1669,6 +1672,8 @@ debug_data_collector()
|
||||||
ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt
|
ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt
|
||||||
gcc --version &> $debug_data_dir/gcc-version.txt
|
gcc --version &> $debug_data_dir/gcc-version.txt
|
||||||
clang --version &> $debug_data_dir/clang-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 /etc/issue &> $debug_data_dir/etc-issue.txt
|
||||||
cat $FILE_LSB_RELEASE &> $debug_data_dir/lsb-release.txt
|
cat $FILE_LSB_RELEASE &> $debug_data_dir/lsb-release.txt
|
||||||
cat $FILE_OS_RELEASE &> $debug_data_dir/os-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 'Creating inxi output file now. This can take a few seconds...'
|
||||||
echo "Starting $SCRIPT_NAME from: $start_directory"
|
echo "Starting $SCRIPT_NAME from: $start_directory"
|
||||||
cd $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
|
cp $LOG_FILE $SCRIPT_DATA_DIR/$debug_data_dir
|
||||||
if [[ -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz ]];then
|
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"
|
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:/) {
|
else if (/kernel modules:/) {
|
||||||
modules[audioCard] = modules[audioCard] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) ""
|
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)
|
portsTemp = gensub(/\t*I\/O ports at (.*) \[.*\]/,"\\1","g",$0)
|
||||||
ports[audioCard] = ports[audioCard] portsTemp " "
|
ports[audioCard] = ports[audioCard] portsTemp " "
|
||||||
}
|
}
|
||||||
|
@ -4165,7 +4170,7 @@ get_desktop_environment()
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
|
|
||||||
# set the default, this function only runs in X, if null, don't print data out
|
# 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=''
|
local version='' version_data='' toolkit=''
|
||||||
|
|
||||||
# works on 4, assume 5 will id the same, why not, no need to update in future
|
# 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"
|
desktop_environment="MATE"
|
||||||
# note, GNOME_DESKTOP_SESSION_ID is deprecated so we'll see how that works out
|
# note, GNOME_DESKTOP_SESSION_ID is deprecated so we'll see how that works out
|
||||||
# https://bugzilla.gnome.org/show_bug.cgi?id=542880
|
# 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
|
if type -p gnome-shell &>/dev/null;then
|
||||||
version=$( get_program_version 'gnome-shell' 'gnome' '3' )
|
version=$( get_program_version 'gnome-shell' 'gnome' '3' )
|
||||||
elif type -p gnome-about &>/dev/null;then
|
elif type -p gnome-about &>/dev/null;then
|
||||||
|
@ -4315,16 +4320,23 @@ get_desktop_environment()
|
||||||
# note: openbox-lxde --version may be present, but returns openbox data
|
# note: openbox-lxde --version may be present, but returns openbox data
|
||||||
version=$( get_program_version 'openbox' '^openbox' '2' )
|
version=$( get_program_version 'openbox' '^openbox' '2' )
|
||||||
if [[ $XDG_CURRENT_DESKTOP == 'LXDE' || \
|
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
|
if [[ -n $version ]];then
|
||||||
version="(Openbox $version)"
|
version="(Openbox $version)"
|
||||||
fi
|
fi
|
||||||
desktop_environment='LXDE'
|
desktop_environment='LXDE'
|
||||||
|
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
|
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
|
if [[ -n $version ]];then
|
||||||
version="(Openbox $version)"
|
version="(Openbox $version)"
|
||||||
fi
|
fi
|
||||||
desktop_environment='Razor-QT'
|
|
||||||
else
|
else
|
||||||
desktop_environment='Openbox'
|
desktop_environment='Openbox'
|
||||||
fi
|
fi
|
||||||
|
@ -4880,9 +4892,9 @@ get_dmidecode_data()
|
||||||
# note stripping out these lines: Handle 0x0016, DMI type 17, 27 bytes
|
# 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
|
# 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
|
# 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.
|
# strip out all the stuff we don't want to see in the results. We want the error data in
|
||||||
DMIDECODE_DATA="$( $dmidecodePath 2>/dev/null \
|
# stdout for error handling
|
||||||
| gawk -F ':' '
|
DMIDECODE_DATA="$( $dmidecodePath 2>&1 | gawk -F ':' '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
IGNORECASE=1
|
IGNORECASE=1
|
||||||
cutExtraTab="false"
|
cutExtraTab="false"
|
||||||
|
@ -4946,9 +4958,18 @@ N
|
||||||
/^\n$/D
|
/^\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
|
fi
|
||||||
B_DMIDECODE_SET='true'
|
B_DMIDECODE_SET='true'
|
||||||
log_function_data "DMIDECODE_DATA: $DMIDECODE_DATA"
|
log_function_data "DMIDECODE_DATA (POST): $DMIDECODE_DATA"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
|
@ -6099,10 +6120,8 @@ get_machine_data()
|
||||||
else
|
else
|
||||||
get_dmidecode_data
|
get_dmidecode_data
|
||||||
if [[ -n $DMIDECODE_DATA ]];then
|
if [[ -n $DMIDECODE_DATA ]];then
|
||||||
if [[ $B_ROOT == 'true' ]];then
|
if [[ $DMIDECODE_DATA == 'dmidecode-error-'* ]];then
|
||||||
# this handles very old systems, like Lenny 2.6.26, with dmidecode, but no data
|
array_string=$DMIDECODE_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
|
# please note: only dmidecode version 2.11 or newer supports consistently the -s flag
|
||||||
else
|
else
|
||||||
array_string=$( gawk -F ':' '
|
array_string=$( gawk -F ':' '
|
||||||
|
@ -6203,9 +6222,6 @@ get_machine_data()
|
||||||
}
|
}
|
||||||
}' <<< "$DMIDECODE_DATA" )
|
}' <<< "$DMIDECODE_DATA" )
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
array_string='dmidecode-non-root-user'
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
IFS=','
|
IFS=','
|
||||||
|
@ -6309,6 +6325,7 @@ get_module_version_number()
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
## create array of network cards
|
## create array of network cards
|
||||||
get_networking_data()
|
get_networking_data()
|
||||||
{
|
{
|
||||||
|
@ -6319,72 +6336,64 @@ get_networking_data()
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_NETWORK_DATA=( $(
|
A_NETWORK_DATA=( $(
|
||||||
echo "$Lspci_v_Data" | gawk '
|
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 {
|
BEGIN {
|
||||||
IGNORECASE=1
|
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).*$/ {
|
/^[0-9a-f:\.]+ ((ethernet|network) (controller|bridge)|infiniband)/ || /^[0-9a-f:\.]+ [^:]+: .*(ethernet|infiniband|network).*$/ {
|
||||||
nic=gensub(/^[0-9a-f:\.]+ [^:]+: (.+)$/,"\\1","g",$0)
|
aNic[counter]=gensub(/^[0-9a-f:\.]+ [^:]+: (.+)$/,"\\1","g",$0)
|
||||||
#gsub(/realtek semiconductor/, "Realtek", nic)
|
#gsub(/realtek semiconductor/, "Realtek", aNic[counter])
|
||||||
#gsub(/davicom semiconductor/, "Davicom", nic)
|
#gsub(/davicom semiconductor/, "Davicom", aNic[counter])
|
||||||
# The doublequotes are necessary because of the pipes in the variable.
|
# The doublequotes are necessary because of the pipes in the variable.
|
||||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", nic)
|
gsub(/'"$BAN_LIST_NORMAL"'/, "", aNic[counter])
|
||||||
gsub(/,/, " ", nic)
|
gsub(/,/, " ", aNic[counter])
|
||||||
gsub(/^ +| +$/, "", nic)
|
gsub(/^ +| +$/, "", aNic[counter])
|
||||||
gsub(/ [ \t]+/, " ", nic)
|
gsub(/ [ \t]+/, " ", aNic[counter])
|
||||||
# construct a unique string ending for each chipset detected, this allows for
|
aPciBusId[counter] = gensub(/(^[0-9a-f:\.]+) [^:]+: .+$/,"\\1","g",$0)
|
||||||
# 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]++
|
|
||||||
while ( getline && !/^$/ ) {
|
while ( getline && !/^$/ ) {
|
||||||
gsub(/,/, "", $0)
|
gsub(/,/, "", $0)
|
||||||
if ( /I\/O/ ) {
|
if ( /^[[:space:]]*I\/O/ ) {
|
||||||
ports[nic] = ports[nic] $4 " "
|
aPorts[counter] = aPorts[counter] $4 " "
|
||||||
}
|
}
|
||||||
if ( /driver in use/ ) {
|
if ( /driver in use/ ) {
|
||||||
drivers[nic] = drivers[nic] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) ""
|
aDrivers[counter] = aDrivers[counter] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) ""
|
||||||
}
|
}
|
||||||
else if ( /kernel modules/ ) {
|
else if ( /kernel modules/ ) {
|
||||||
modules[nic] = modules[nic] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) ""
|
aModules[counter] = aModules[counter] gensub( /(.*): (.*)/ ,"\\2" ,"g" ,$0 ) ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
counter++
|
||||||
}
|
}
|
||||||
|
|
||||||
END {
|
END {
|
||||||
j=0
|
for (i=0;i<counter;i++) {
|
||||||
for (i in eth) {
|
|
||||||
useDrivers=""
|
useDrivers=""
|
||||||
usePorts=""
|
usePorts=""
|
||||||
useModules=""
|
useModules=""
|
||||||
|
useNic=""
|
||||||
usePciBusId=""
|
usePciBusId=""
|
||||||
|
|
||||||
if ( eth[i] > 1 ) {
|
|
||||||
a[j] = eth[i] "x " i
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
a[j] = i
|
|
||||||
}
|
|
||||||
## note: this loses the plural ports case, is it needed anyway?
|
## note: this loses the plural ports case, is it needed anyway?
|
||||||
if ( ports[i] != "" ) {
|
if ( aPorts[i] != "" ) {
|
||||||
usePorts = ports[i]
|
usePorts = aPorts[i]
|
||||||
}
|
}
|
||||||
if ( drivers[i] != "" ) {
|
if ( aDrivers[i] != "" ) {
|
||||||
useDrivers = drivers[i]
|
useDrivers = aDrivers[i]
|
||||||
}
|
}
|
||||||
if ( modules[i] != "" ) {
|
if ( aModules[i] != "" ) {
|
||||||
useModules = modules[i]
|
useModules = aModules[i]
|
||||||
|
}
|
||||||
|
if ( aNic[i] != "" ) {
|
||||||
|
useNic=aNic[i]
|
||||||
}
|
}
|
||||||
if ( aPciBusId[i] != "" ) {
|
if ( aPciBusId[i] != "" ) {
|
||||||
usePciBusId = aPciBusId[i]
|
usePciBusId = aPciBusId[i]
|
||||||
}
|
}
|
||||||
# create array primary item for master array
|
# 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
|
sub( / $/, "", usePorts ) # clean off trailing whitespace
|
||||||
print a[j] "," useDrivers "," usePorts "," useModules, "," usePciBusId
|
print useNic "," useDrivers "," usePorts "," useModules, "," usePciBusId
|
||||||
j++
|
|
||||||
}
|
}
|
||||||
}' ) )
|
}' ) )
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
@ -6401,43 +6410,60 @@ get_networking_data()
|
||||||
get_network_advanced_data()
|
get_network_advanced_data()
|
||||||
{
|
{
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
local a_network_adv_working='' if_path='' working_path='' working_uevent_path='' dir_path=''
|
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=''
|
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=''
|
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
|
do
|
||||||
IFS=","
|
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
|
# reset these every go round
|
||||||
driver_test=''
|
driver_test=''
|
||||||
if_id=''
|
if_data=''
|
||||||
speed=''
|
product_path=''
|
||||||
duplex=''
|
|
||||||
mac_id=''
|
|
||||||
oper_state=''
|
|
||||||
usb_data=''
|
usb_data=''
|
||||||
chip_id=''
|
usb_product=''
|
||||||
|
usb_vendor=''
|
||||||
|
working_path=''
|
||||||
|
working_uevent_path=''
|
||||||
if [[ -z $( grep '^usb-' <<< ${a_network_adv_working[4]} ) ]];then
|
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
|
# 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
|
# 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
|
# /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
|
# 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
|
# 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']:
|
# /sys/devices/pci0000:00/0000:00:03.0/0000:03:00.0/ssb0:0/uevent:['DRIVER=b43', 'MODALIAS=ssb:v4243id0812rev0D']:
|
||||||
|
# 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]}"
|
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.
|
# 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 )
|
working_path=$( readlink -f $working_path 2>/dev/null )
|
||||||
|
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
|
# sometimes there is another directory between the path and /net
|
||||||
if [[ ! -e $working_path/net ]];then
|
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
|
# 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
|
# 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 | \
|
working_path=$( find $working_path/*/net/*/uevent 2>/dev/null | \
|
||||||
sed 's|/net.*||' )
|
sed 's|/net.*||' )
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
# working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent )
|
# working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent )
|
||||||
else
|
else
|
||||||
# now we'll use the actual vendor:product string instead
|
# now we'll use the actual vendor:product string instead
|
||||||
|
@ -6459,7 +6485,6 @@ get_network_advanced_data()
|
||||||
product_path=$( grep -s "$usb_product" /sys/devices/pci*/*/usb*/*/*/idProduct | \
|
product_path=$( grep -s "$usb_product" /sys/devices/pci*/*/usb*/*/*/idProduct | \
|
||||||
sed -e "s/idProduct:$usb_product//" -e '/driver/d' )
|
sed -e "s/idProduct:$usb_product//" -e '/driver/d' )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make sure it's the right product/vendor match here, it will almost always be but let's be sure
|
# 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 && -n $product_path ]] && [[ $working_path == $product_path ]];then
|
||||||
#if [[ -n $working_path ]];then
|
#if [[ -n $working_path ]];then
|
||||||
|
@ -6477,50 +6502,90 @@ get_network_advanced_data()
|
||||||
a_network_adv_working[1]=$driver_test
|
a_network_adv_working[1]=$driver_test
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
#echo wp: $working_path
|
||||||
log_function_data "PRE: working_path: $working_path\nworking_uevent_path: $working_uevent_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
|
# 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:
|
# the short path, minus the last longer numeric directory name, ie:
|
||||||
# from debian squeeze 2.6.32-5-686:
|
# from debian squeeze 2.6.32-5-686:
|
||||||
# /sys/devices/pci0000:00/0000:00:0b.1/usb1/1-1/net/wlan0/address
|
# /sys/devices/pci0000:00/0000:00:0b.1/usb1/1-1/net/wlan0/address
|
||||||
if [[ -e $working_path/net ]];then
|
if [[ -e $working_path/net ]];then
|
||||||
if_path=$( ls $working_path/net 2>/dev/null )
|
# in cases like infiniband dual port devices, there can be two ids, like ib0 ib1,
|
||||||
if_id=$if_path
|
# with line break in output
|
||||||
working_path=$working_path/net/$if_path
|
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
|
# this is the normal usb detection if the first one didn't work
|
||||||
elif [[ -n $usb_data && -e $working_uevent_path/net ]];then
|
elif [[ -n $usb_data && -e $working_uevent_path/net ]];then
|
||||||
if_path=$( ls $working_uevent_path/net 2>/dev/null )
|
if_data=$( ls $working_uevent_path/net 2>/dev/null )
|
||||||
if_id=$if_path
|
working_path=$working_uevent_path/net/$if_data
|
||||||
working_path=$working_uevent_path/net/$if_path
|
|
||||||
# 2.6.32 debian lenny kernel shows not: /net/eth0 but /net:eth0
|
# 2.6.32 debian lenny kernel shows not: /net/eth0 but /net:eth0
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
#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
|
else
|
||||||
if_path=$( ls $working_path 2>/dev/null | grep 'net:' )
|
full_path=$working_path
|
||||||
if_id=$( cut -d ':' -f 2 <<< "$if_path" )
|
|
||||||
working_path=$working_path/$if_path
|
|
||||||
fi
|
fi
|
||||||
log_function_data "POST: working_path: $working_path\nif_path: $if_path - if_id: $if_id"
|
if [[ -r $full_path/speed ]];then
|
||||||
|
speed=$( cat $full_path/speed 2>/dev/null )
|
||||||
if [[ -n $if_path ]];then
|
|
||||||
if [[ -r $working_path/speed ]];then
|
|
||||||
speed=$( cat $working_path/speed 2>/dev/null )
|
|
||||||
fi
|
fi
|
||||||
if [[ -r $working_path/duplex ]];then
|
if [[ -r $full_path/duplex ]];then
|
||||||
duplex=$( cat $working_path/duplex 2>/dev/null )
|
duplex=$( cat $full_path/duplex 2>/dev/null )
|
||||||
fi
|
fi
|
||||||
if [[ -r $working_path/address ]];then
|
if [[ -r $full_path/address ]];then
|
||||||
mac_id=$( cat $working_path/address 2>/dev/null )
|
mac_id=$( cat $full_path/address 2>/dev/null )
|
||||||
fi
|
fi
|
||||||
if [[ -r $working_path/operstate ]];then
|
if [[ -r $full_path/operstate ]];then
|
||||||
oper_state=$( cat $working_path/operstate 2>/dev/null )
|
oper_state=$( cat $full_path/operstate 2>/dev/null )
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n ${a_network_adv_working[10]} ]];then
|
if [[ -n ${a_network_adv_working[10]} ]];then
|
||||||
chip_id=${a_network_adv_working[10]}
|
chip_id=${a_network_adv_working[10]}
|
||||||
fi
|
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
|
fi
|
||||||
IFS="$ORIGINAL_IFS"
|
|
||||||
|
#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
|
||||||
|
done
|
||||||
|
a_temp=${A_NETWORK_DATA[@]}
|
||||||
|
log_function_data "A_NETWORK_DATA (advanced): $a_temp"
|
||||||
|
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
}
|
}
|
||||||
|
@ -6597,7 +6662,7 @@ get_networking_wan_ip_data()
|
||||||
# awk has bad regex handling so checking it with grep -E instead
|
# 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=$( echo 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | gawk --re-interval '
|
||||||
# ip=$( wget -q -O - $WAN_IP_URL | 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")
|
#gsub("\n","",$2")
|
||||||
print $NF
|
print $NF
|
||||||
|
@ -10320,7 +10385,7 @@ print_info_data()
|
||||||
if [[ $shell_parent == 'login' ]];then
|
if [[ $shell_parent == 'login' ]];then
|
||||||
shell_parent=''
|
shell_parent=''
|
||||||
elif [[ -n $shell_parent ]];then
|
elif [[ -n $shell_parent ]];then
|
||||||
shell_parent=" running in $shell_parent"
|
shell_parent=" running in ${shell_parent##*/}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
IRC_CLIENT="$IRC_CLIENT ($shell_data$shell_parent)"
|
IRC_CLIENT="$IRC_CLIENT ($shell_data$shell_parent)"
|
||||||
|
@ -10561,11 +10626,10 @@ print_machine_data()
|
||||||
system_line="${C2}$sysDmiNull"
|
system_line="${C2}$sysDmiNull"
|
||||||
fi
|
fi
|
||||||
# patch to dump all of above if dmidecode was data source and non root user
|
# patch to dump all of above if dmidecode was data source and non root user
|
||||||
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' || \
|
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-error-'* ]];then
|
||||||
${A_MACHINE_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
|
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-error-requires-root' ]];then
|
||||||
if [[ ${A_MACHINE_DATA[0]} == 'dmidecode-non-root-user' ]];then
|
|
||||||
system_line="${C2}${sysDmiError}dmidecode: you must be root to run dmidecode"
|
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"
|
system_line="${C2}${sysDmiError}dmidecode: no machine data available"
|
||||||
fi
|
fi
|
||||||
mobo_line=''
|
mobo_line=''
|
||||||
|
@ -10598,11 +10662,10 @@ print_memory_data()
|
||||||
memory_line=$( create_print_line "Memory:" "$memory_line${CN}" )
|
memory_line=$( create_print_line "Memory:" "$memory_line${CN}" )
|
||||||
print_screen_output "$memory_line"
|
print_screen_output "$memory_line"
|
||||||
|
|
||||||
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-non-root-user' || \
|
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-'* ]];then
|
||||||
${A_MEMORY_DATA[0]} == 'dmidecode-no-smbios-dmi-data' ]];then
|
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-error-requires-root' ]];then
|
||||||
if [[ ${A_MEMORY_DATA[0]} == 'dmidecode-non-root-user' ]];then
|
|
||||||
memory_line="${C2}${sysDmiError}dmidecode: you must be root to run dmidecode"
|
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"
|
memory_line="${C2}${sysDmiError}dmidecode: no machine data available"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue