mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
the puppy problem came down to YES booleans have to be == true/false, etc. So all booleans were redone appropriately. Test this for a bit, and get feedback, then commit as .9?
This commit is contained in:
parent
c7caa8572a
commit
423d7f5826
165
inxi
165
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.8.13.b2.3
|
#### version: 0.8.13.b2.4
|
||||||
#### Date: December 22 2008
|
#### Date: December 22 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
||||||
|
@ -150,11 +150,8 @@ B_TESTING_1='false'
|
||||||
B_TESTING_2='false'
|
B_TESTING_2='false'
|
||||||
# Test for X running
|
# Test for X running
|
||||||
B_X_RUNNING='false'
|
B_X_RUNNING='false'
|
||||||
if [[ -n $DISPLAY ]];then
|
|
||||||
B_X_RUNNING='true'
|
|
||||||
fi
|
|
||||||
|
|
||||||
### Directory/file exist flags
|
### Directory/file exist flags; test as [[ $(boolean) ]] not [[ $boolean ]]
|
||||||
B_PROC='false'
|
B_PROC='false'
|
||||||
B_CPUINFO='false'
|
B_CPUINFO='false'
|
||||||
B_MEMINFO='false'
|
B_MEMINFO='false'
|
||||||
|
@ -381,7 +378,7 @@ init()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e "$SCSI_DIR" ]];then
|
if [[ -e "$SCSI_DIR" ]];then
|
||||||
B_SCSI_DIR='false'
|
B_SCSI_DIR='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# lack of ifconfig will throw an error only upon it's usage
|
# lack of ifconfig will throw an error only upon it's usage
|
||||||
|
@ -389,6 +386,9 @@ init()
|
||||||
B_IFCONFIG='true'
|
B_IFCONFIG='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n $DISPLAY ]];then
|
||||||
|
B_X_RUNNING='true'
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_script_suggested_apps()
|
check_script_suggested_apps()
|
||||||
|
@ -495,7 +495,7 @@ error_handler()
|
||||||
# args: $1 - $@ debugging string text
|
# args: $1 - $@ debugging string text
|
||||||
script_debugger()
|
script_debugger()
|
||||||
{
|
{
|
||||||
if [[ $B_SCRIPT_UP == 'true' ]];then
|
if [[ $(B_SCRIPT_UP) ]];then
|
||||||
# only return if debugger is off and no pre start up errors have occured
|
# only return if debugger is off and no pre start up errors have occured
|
||||||
if [[ $DEBUG -eq 0 && $DEBUG_BUFFER_INDEX -eq 0 ]];then
|
if [[ $DEBUG -eq 0 && $DEBUG_BUFFER_INDEX -eq 0 ]];then
|
||||||
return 0
|
return 0
|
||||||
|
@ -1202,7 +1202,7 @@ get_audio_data()
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
# this first step handles the drivers for cases where the second step fails to find one
|
# this first step handles the drivers for cases where the second step fails to find one
|
||||||
device_count=$( egrep -ic '(multimedia audio controller|audio device)' <<< "$lspci_data" )
|
device_count=$( egrep -ic '(multimedia audio controller|audio device)' <<< "$lspci_data" )
|
||||||
if [[ $device_count -eq 1 && -f $ASOUND_DEVICE ]];then
|
if [[ $device_count -eq 1 ]] && [[ $B_ASOUND_CARDS == 'true' ]];then
|
||||||
alsa_driver=$( gawk -F ']: ' '
|
alsa_driver=$( gawk -F ']: ' '
|
||||||
{ IGNORECASE=1 }
|
{ IGNORECASE=1 }
|
||||||
# filtering out modems and usb devices like webcams, this might get a
|
# filtering out modems and usb devices like webcams, this might get a
|
||||||
|
@ -1289,7 +1289,7 @@ get_audio_data()
|
||||||
}') )
|
}') )
|
||||||
|
|
||||||
# in case of failure of first check do this instead
|
# in case of failure of first check do this instead
|
||||||
if [[ ${#A_AUDIO_DATA[@]} -eq 0 && -f $ASOUND_DEVICE ]];then
|
if [[ ${#A_AUDIO_DATA[@]} -eq 0 ]] && [[ $B_ASOUND_CARDS ]];then
|
||||||
A_AUDIO_DATA=( $( gawk -F ']: ' '
|
A_AUDIO_DATA=( $( gawk -F ']: ' '
|
||||||
{ IGNORECASE=1 }
|
{ IGNORECASE=1 }
|
||||||
$1 !~ /modem/ && $2 !~ /modem/ {
|
$1 !~ /modem/ && $2 !~ /modem/ {
|
||||||
|
@ -1313,7 +1313,7 @@ get_audio_alsa_data()
|
||||||
local alsa_data=''
|
local alsa_data=''
|
||||||
|
|
||||||
# now we'll get the alsa data if the file exists
|
# now we'll get the alsa data if the file exists
|
||||||
if [[ $B_ASOUND_VERSION ]];then
|
if [[ $B_ASOUND_VERSION == 'true' ]];then
|
||||||
alsa_data=$( gawk '
|
alsa_data=$( gawk '
|
||||||
{ IGNORECASE=1 }
|
{ IGNORECASE=1 }
|
||||||
# some alsa strings have the build date in (...)
|
# some alsa strings have the build date in (...)
|
||||||
|
@ -1335,17 +1335,19 @@ get_audio_alsa_data()
|
||||||
## return value cpu core count string, this helps resolve the multi redundant lines of old style output
|
## return value cpu core count string, this helps resolve the multi redundant lines of old style output
|
||||||
get_cpu_core_count()
|
get_cpu_core_count()
|
||||||
{
|
{
|
||||||
## Because of the upcoming release of cpus with core counts over 6, a count of cores is given after Deca (10)
|
if [[ $B_CPUINFO == 'true' ]]; then
|
||||||
# count the number of processors given
|
## Because of the upcoming release of cpus with core counts over 6, a count of cores is given after Deca (10)
|
||||||
local cpu_core_count=$(grep -ic "cpu cores" $CPUINFO| cut -d':' -f2)
|
# count the number of processors given
|
||||||
|
local cpu_core_count=$(grep -ic "cpu cores" $CPUINFO| cut -d':' -f2)
|
||||||
|
|
||||||
if [[ $cpu_core_count -eq 0 ]];then
|
if [[ $cpu_core_count -eq 0 ]];then
|
||||||
cpu_core_count=$(grep -ic "^processor" $CPUINFO| cut -d':' -f2)
|
cpu_core_count=$(grep -ic "^processor" $CPUINFO| cut -d':' -f2)
|
||||||
fi
|
fi
|
||||||
local cpu_alpha_count=''
|
local cpu_alpha_count=''
|
||||||
|
|
||||||
if [[ $cpu_core_count -lt 2 ]]; then
|
if [[ $cpu_core_count -lt 2 ]]; then
|
||||||
cpu_core_count=1
|
cpu_core_count=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# match the numberic value to an alpha value
|
# match the numberic value to an alpha value
|
||||||
|
@ -1371,67 +1373,69 @@ get_cpu_data()
|
||||||
{
|
{
|
||||||
local i='' j='' cpu_array_nu='' a_cpu_working='' multi_cpu='' bits=''
|
local i='' j='' cpu_array_nu='' a_cpu_working='' multi_cpu='' bits=''
|
||||||
|
|
||||||
IFS=$'\n'
|
if [[ $B_CPUINFO == 'true' ]];then
|
||||||
A_CPU_DATA=($(gawk -F': ' '
|
IFS=$'\n'
|
||||||
{ IGNORECASE=1 }
|
A_CPU_DATA=($(gawk -F': ' '
|
||||||
# TAKE NOTE: \t+ will work for $CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES!
|
{ IGNORECASE=1 }
|
||||||
# Therefore PATCH to use [ \t]+ when TESTING!
|
# TAKE NOTE: \t+ will work for $CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES!
|
||||||
/^processor\t+:/ { nr = $NF }
|
# Therefore PATCH to use [ \t]+ when TESTING!
|
||||||
|
/^processor\t+:/ { nr = $NF }
|
||||||
|
|
||||||
/^model name|^cpu\t+:/ {
|
/^model name|^cpu\t+:/ {
|
||||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
|
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
|
||||||
gsub(/'"$BAN_LIST_CPU"'/, "", $NF )
|
gsub(/'"$BAN_LIST_CPU"'/, "", $NF )
|
||||||
gsub(/,/, " ", $NF)
|
gsub(/,/, " ", $NF)
|
||||||
gsub(/^ +| +$/, "", $NF)
|
gsub(/^ +| +$/, "", $NF)
|
||||||
gsub(/ [ \t]+/, " ", $NF)
|
gsub(/ [ \t]+/, " ", $NF)
|
||||||
cpu[nr, "model"] = $NF
|
cpu[nr, "model"] = $NF
|
||||||
}
|
|
||||||
|
|
||||||
/^cpu MHz|^clock\t+:/ {
|
|
||||||
if (!min) {
|
|
||||||
min = $NF
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if ($NF < min) {
|
/^cpu MHz|^clock\t+:/ {
|
||||||
|
if (!min) {
|
||||||
min = $NF
|
min = $NF
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if ($NF < min) {
|
||||||
|
min = $NF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($NF > max) {
|
||||||
|
max = $NF
|
||||||
|
}
|
||||||
|
gsub(/MHZ/,"",$NF) ## clears out for cell cpu
|
||||||
|
gsub(/.00[0]+$/,".00",$NF) ## clears out excessive zeros
|
||||||
|
cpu[nr, "speed"] = $NF
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($NF > max) {
|
/^cache size/ { cpu[nr, "cache"] = $NF }
|
||||||
max = $NF
|
|
||||||
}
|
|
||||||
gsub(/MHZ/,"",$NF) ## clears out for cell cpu
|
|
||||||
gsub(/.00[0]+$/,".00",$NF) ## clears out excessive zeros
|
|
||||||
cpu[nr, "speed"] = $NF
|
|
||||||
}
|
|
||||||
|
|
||||||
/^cache size/ { cpu[nr, "cache"] = $NF }
|
/^flags/ { cpu[nr, "flags"] = $NF }
|
||||||
|
|
||||||
/^flags/ { cpu[nr, "flags"] = $NF }
|
/^bogomips/ { cpu[nr, "bogomips"] = $NF }
|
||||||
|
|
||||||
/^bogomips/ { cpu[nr, "bogomips"] = $NF }
|
/vendor_id/ {
|
||||||
|
gsub(/genuine|authentic/,"",$NF)
|
||||||
|
cpu[nr, "vendor"] = tolower( $NF )
|
||||||
|
}
|
||||||
|
|
||||||
/vendor_id/ {
|
END {
|
||||||
gsub(/genuine|authentic/,"",$NF)
|
#if (!nr) { print ",,,"; exit } # <- should this be necessary or should bash handle that
|
||||||
cpu[nr, "vendor"] = tolower( $NF )
|
for ( i = 0; i <= nr; i++ ) {
|
||||||
}
|
print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"]
|
||||||
|
}
|
||||||
END {
|
if (!min) {
|
||||||
#if (!nr) { print ",,,"; exit } # <- should this be necessary or should bash handle that
|
print "not found"
|
||||||
for ( i = 0; i <= nr; i++ ) {
|
exit
|
||||||
print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"]
|
}
|
||||||
}
|
if (min != max) {
|
||||||
if (!min) {
|
printf("Min:%s%s Max:%s%s\n", min, "Mhz", max, "Mhz")
|
||||||
print "not found"
|
}
|
||||||
exit
|
else {
|
||||||
}
|
printf("%s %s\n", max, "Mhz")
|
||||||
if (min != max) {
|
}
|
||||||
printf("Min:%s%s Max:%s%s\n", min, "Mhz", max, "Mhz")
|
}' $CPUINFO))
|
||||||
}
|
fi
|
||||||
else {
|
|
||||||
printf("%s %s\n", max, "Mhz")
|
|
||||||
}
|
|
||||||
}' $CPUINFO))
|
|
||||||
|
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
}
|
}
|
||||||
|
@ -1465,7 +1469,7 @@ get_distro_data()
|
||||||
# because Mint does not use such, it must be done as below
|
# because Mint does not use such, it must be done as below
|
||||||
## this if statement requires the spaces and * as it is, else it won't work
|
## this if statement requires the spaces and * as it is, else it won't work
|
||||||
##
|
##
|
||||||
if [[ " $DISTROS_LSB_GOOD " == *" ${i} "* && "$B_LSB_DIR" ]];then
|
if [[ " $DISTROS_LSB_GOOD " == *" ${i} "* ]] && [[ $B_LSB_DIR == 'true' ]];then
|
||||||
distro_file='lsb-release'
|
distro_file='lsb-release'
|
||||||
else
|
else
|
||||||
distro_file="${i}"
|
distro_file="${i}"
|
||||||
|
@ -1489,8 +1493,8 @@ get_distro_data()
|
||||||
# otherwise try the default debian/ubuntu /etc/issue file
|
# otherwise try the default debian/ubuntu /etc/issue file
|
||||||
elif [[ -f /etc/issue ]];then
|
elif [[ -f /etc/issue ]];then
|
||||||
# lsb gives more manageable and accurate output than issue, but mint should use issue for now
|
# lsb gives more manageable and accurate output than issue, but mint should use issue for now
|
||||||
# something here allows puppy linux into the mint section
|
# some bashism, boolean must be in parenthesis to work correctly, ie [[ $(boolean) ]] not [[ $boolean ]]
|
||||||
if [[ $B_LSB_DIR ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then
|
if [[ $B_LSB_DIR == 'true' ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then
|
||||||
distro=$( get_distro_lsb_data )
|
distro=$( get_distro_lsb_data )
|
||||||
else
|
else
|
||||||
distro=$( gawk '
|
distro=$( gawk '
|
||||||
|
@ -1504,14 +1508,14 @@ get_distro_data()
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${#distro} -gt 80 && $B_HANDLE_CORRUPT_DATA != 'true' ]];then
|
if [[ ${#distro} -gt 80 ]] && [[ $B_HANDLE_CORRUPT_DATA != 'true' ]];then
|
||||||
distro="${RED}/etc/${distro_file} corrupted, use -% to override${NORMAL}"
|
distro="${RED}/etc/${distro_file} corrupted, use -% to override${NORMAL}"
|
||||||
fi
|
fi
|
||||||
## note: would like to actually understand the method even if it's not used
|
## note: would like to actually understand the method even if it's not used
|
||||||
# : ${distro:=Unknown distro o_O}
|
# : ${distro:=Unknown distro o_O}
|
||||||
## test for /etc/lsb-release as a backup in case of failure, in cases where > one version/release file
|
## test for /etc/lsb-release as a backup in case of failure, in cases where > one version/release file
|
||||||
## were found but the above resulted in null distro value
|
## were found but the above resulted in null distro value
|
||||||
if [[ -z $distro && "$B_LSB_DIR" ]];then
|
if [[ -z $distro ]] && [[ $B_LSB_DIR == 'true' ]];then
|
||||||
distro=$( get_distro_lsb_data )
|
distro=$( get_distro_lsb_data )
|
||||||
fi
|
fi
|
||||||
## finally, if all else has failed, give up
|
## finally, if all else has failed, give up
|
||||||
|
@ -1532,7 +1536,7 @@ get_distro_lsb_data()
|
||||||
{
|
{
|
||||||
local distro=''
|
local distro=''
|
||||||
|
|
||||||
if [[ "$B_LSB_DIR" && $1 != 'app' ]];then
|
if [[ $B_LSB_DIR == 'true' ]] && [[ $1 != 'app' ]];then
|
||||||
distro=$( gawk -F '=' '
|
distro=$( gawk -F '=' '
|
||||||
|
|
||||||
{ IGNORECASE=1 }
|
{ IGNORECASE=1 }
|
||||||
|
@ -1837,7 +1841,7 @@ get_hard_drive_data_advanced()
|
||||||
## then handle libata names
|
## then handle libata names
|
||||||
# first get the ata device names, put them into an array
|
# first get the ata device names, put them into an array
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
if [[ $B_SCSI_DIR ]]; then
|
if [[ $B_SCSI_DIR == 'true' ]]; then
|
||||||
a_temp_scsi=( $( gawk '
|
a_temp_scsi=( $( gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN { IGNORECASE=1 }
|
||||||
/host/ {
|
/host/ {
|
||||||
|
@ -2045,7 +2049,7 @@ get_networking_wan_ip_data()
|
||||||
|
|
||||||
get_networking_local_ip_data()
|
get_networking_local_ip_data()
|
||||||
{
|
{
|
||||||
if [[ $B_IFCONFIG ]];then
|
if [[ $B_IFCONFIG == 'true' ]];then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_INTERFACES_DATA=( $( ifconfig | gawk '
|
A_INTERFACES_DATA=( $( ifconfig | gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN { IGNORECASE=1 }
|
||||||
|
@ -2091,6 +2095,7 @@ get_networking_local_ip_data()
|
||||||
get_partition_data()
|
get_partition_data()
|
||||||
{
|
{
|
||||||
#local excluded_file_types='--exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660'
|
#local excluded_file_types='--exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660'
|
||||||
|
# df doesn't seem to work in script with variables like at the command line
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
# sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home
|
# sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home
|
||||||
|
@ -2573,7 +2578,7 @@ print_gfx_data()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## note: if glx render or version have no content, then mesa is true
|
## note: if glx render or version have no content, then mesa is true
|
||||||
if [[ $B_X_RUNNING == 'true' && $b_is_mesa != 'true' ]];then
|
if [[ $B_X_RUNNING == 'true' ]] && [[ $b_is_mesa != 'true' ]];then
|
||||||
gfx_data=$( create_print_line " " "${C1}GLX Renderer${C2} ${glx_renderer} ${C1}GLX Version${C2} ${glx_version}${CN}" )
|
gfx_data=$( create_print_line " " "${C1}GLX Renderer${C2} ${glx_renderer} ${C1}GLX Version${C2} ${glx_version}${CN}" )
|
||||||
if [[ $B_HANDLE_CORRUPT_DATA == 'true' ]];then
|
if [[ $B_HANDLE_CORRUPT_DATA == 'true' ]];then
|
||||||
gfx_data="${gfx_data} ${C1}Direct rendering${C2} ${glx_direct_render}${CN}"
|
gfx_data="${gfx_data} ${C1}Direct rendering${C2} ${glx_direct_render}${CN}"
|
||||||
|
@ -2598,7 +2603,7 @@ print_hard_disk_data()
|
||||||
local hdd_capacity=${a_hdd_basic_working[0]}
|
local hdd_capacity=${a_hdd_basic_working[0]}
|
||||||
local hdd_used=${a_hdd_basic_working[1]}
|
local hdd_used=${a_hdd_basic_working[1]}
|
||||||
|
|
||||||
if [[ $VERBOSITY_LEVEL -ge 3 || $B_SHOW_DISK == 'true' ]];then
|
if [[ $VERBOSITY_LEVEL -ge 3 ]] || [[ $B_SHOW_DISK == 'true' ]];then
|
||||||
## note: the output part of this should be in the print hdd data function, not here
|
## note: the output part of this should be in the print hdd data function, not here
|
||||||
get_hard_drive_data_advanced
|
get_hard_drive_data_advanced
|
||||||
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
|
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
|
||||||
|
|
Loading…
Reference in a new issue