mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
(Change version number)
Fixed syntax of gawk, made it all consistent, one method for everything, hanging { now in gawk for all structures and flow controls Fixed small double space thing for kernel output also. Removed all one liners from gawk, like BEGIN { IGNORECASE = 1 }, and now use NO one liner flow controls at all. This is the new convention, neither trash nor I were comfortable enough with gawk to really check the actual programming syntax, but now it's kind of obvious that the same rules apply: all one liner flow controls hide logic, and give bugs somewhere to live. Same as any other language. What a surprise.
This commit is contained in:
parent
959caae1f7
commit
5a35c5fb12
217
inxi
217
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.9.6
|
#### version: 0.9.7
|
||||||
#### Date: 24 January 2009
|
#### Date: 26 January 2009
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -68,6 +68,9 @@
|
||||||
#### For all boolean tests, use 'true' / 'false'. Do NOT use 0 or 1 unless
|
#### For all boolean tests, use 'true' / 'false'. Do NOT use 0 or 1 unless
|
||||||
#### it's a function return. Avoid complicated tests in the if condition itself.
|
#### it's a function return. Avoid complicated tests in the if condition itself.
|
||||||
####
|
####
|
||||||
|
#### For gawk: use always if ( num_of_cores > 1 ) { hanging { starter for all blocks
|
||||||
|
#### This lets us use one method for all gawk structures, including BEGIN/END, if, for, etc
|
||||||
|
####
|
||||||
#### VARIABLE/FUNCTION NAMING:
|
#### VARIABLE/FUNCTION NAMING:
|
||||||
#### All variables should explain what they are, except counters like i, j
|
#### All variables should explain what they are, except counters like i, j
|
||||||
#### All variables MUST be initialized / declared explicitly
|
#### All variables MUST be initialized / declared explicitly
|
||||||
|
@ -516,7 +519,10 @@ sanitize_characters()
|
||||||
# bash will interpret the |'s as usual and try to run a subshell!
|
# bash will interpret the |'s as usual and try to run a subshell!
|
||||||
# Using weak quotes instead, or use '"..."'
|
# Using weak quotes instead, or use '"..."'
|
||||||
echo "$2" | gawk "
|
echo "$2" | gawk "
|
||||||
BEGIN { IGNORECASE=1 } {
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
|
{
|
||||||
gsub(/${!1}/,\"\")
|
gsub(/${!1}/,\"\")
|
||||||
gsub(/ [ ]+/,\" \") ## ([ ]+) with (space)
|
gsub(/ [ ]+/,\" \") ## ([ ]+) with (space)
|
||||||
gsub(/^ +| +$/,\"\") ## (pipe char) with (nothing)
|
gsub(/^ +| +$/,\"\") ## (pipe char) with (nothing)
|
||||||
|
@ -743,7 +749,10 @@ remove_erroneous_chars()
|
||||||
## RS is input record separator
|
## RS is input record separator
|
||||||
## gsub is substitute;
|
## gsub is substitute;
|
||||||
gawk '
|
gawk '
|
||||||
BEGIN { RS="" } {
|
BEGIN {
|
||||||
|
RS=""
|
||||||
|
}
|
||||||
|
{
|
||||||
gsub(/\n$/,"") ## (newline; end of string) with (nothing)
|
gsub(/\n$/,"") ## (newline; end of string) with (nothing)
|
||||||
gsub(/\n/," "); ## (newline) with (space)
|
gsub(/\n/," "); ## (newline) with (space)
|
||||||
gsub(/^ *| *$/, "") ## (pipe char) with (nothing)
|
gsub(/^ *| *$/, "") ## (pipe char) with (nothing)
|
||||||
|
@ -1238,7 +1247,9 @@ get_audio_data()
|
||||||
device_count=$( echo "$lspci_data" | egrep -ic '(multimedia audio controller|audio device)' )
|
device_count=$( echo "$lspci_data" | egrep -ic '(multimedia audio controller|audio device)' )
|
||||||
if [[ $device_count -eq 1 ]] && [[ $B_ASOUND_CARDS == 'true' ]];then
|
if [[ $device_count -eq 1 ]] && [[ $B_ASOUND_CARDS == 'true' ]];then
|
||||||
alsa_driver=$( gawk -F ']: ' '
|
alsa_driver=$( gawk -F ']: ' '
|
||||||
{ IGNORECASE=1 }
|
BEGIN {
|
||||||
|
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
|
||||||
# usb audio card as well, this will take some trial and error
|
# usb audio card as well, this will take some trial and error
|
||||||
$0 !~ /modem/ || $0 !~ /usb/ {
|
$0 !~ /modem/ || $0 !~ /usb/ {
|
||||||
|
@ -1256,7 +1267,9 @@ get_audio_data()
|
||||||
# now we'll build the main audio data, card name, driver, and port. If no driver is found,
|
# now we'll build the main audio data, card name, driver, and port. If no driver is found,
|
||||||
# and if the first method above is not null, and one card is found, it will use that instead.
|
# and if the first method above is not null, and one card is found, it will use that instead.
|
||||||
A_AUDIO_DATA=( $( echo "$lspci_data" | gawk -F ': ' -v alsaDriver="$alsa_driver" '
|
A_AUDIO_DATA=( $( echo "$lspci_data" | gawk -F ': ' -v alsaDriver="$alsa_driver" '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/multimedia audio controller|audio device/ {
|
/multimedia audio controller|audio device/ {
|
||||||
audioCard=gensub(/^[0-9a-f:.]+ [^:]+: (.+)$/,"\\1","g",$0)
|
audioCard=gensub(/^[0-9a-f:.]+ [^:]+: (.+)$/,"\\1","g",$0)
|
||||||
# The doublequotes are necessary because of the pipes in the variable.
|
# The doublequotes are necessary because of the pipes in the variable.
|
||||||
|
@ -1326,7 +1339,9 @@ 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 ]] && [[ $B_ASOUND_CARDS == 'true' ]];then
|
if [[ ${#A_AUDIO_DATA[@]} -eq 0 ]] && [[ $B_ASOUND_CARDS == 'true' ]];then
|
||||||
A_AUDIO_DATA=( $( gawk -F ']: ' '
|
A_AUDIO_DATA=( $( gawk -F ']: ' '
|
||||||
{ IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
$1 !~ /modem/ && $2 !~ /modem/ {
|
$1 !~ /modem/ && $2 !~ /modem/ {
|
||||||
card=gensub( /^(.+)( - )(.+)$/, "\\3", 1, $2 )
|
card=gensub( /^(.+)( - )(.+)$/, "\\3", 1, $2 )
|
||||||
driver=gensub( /^(.+)( - )(.+)$/, "\\1", 1, $2 )
|
driver=gensub( /^(.+)( - )(.+)$/, "\\1", 1, $2 )
|
||||||
|
@ -1350,7 +1365,9 @@ get_audio_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 == 'true' ]];then
|
if [[ $B_ASOUND_VERSION == 'true' ]];then
|
||||||
alsa_data=$( gawk '
|
alsa_data=$( gawk '
|
||||||
{ IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
# some alsa strings have the build date in (...)
|
# some alsa strings have the build date in (...)
|
||||||
# remove trailing . and remove possible second line if compiled by user
|
# remove trailing . and remove possible second line if compiled by user
|
||||||
$0 !~ /compile/ {
|
$0 !~ /compile/ {
|
||||||
|
@ -1410,10 +1427,15 @@ get_cpu_data()
|
||||||
if [[ $B_CPUINFO == 'true' ]];then
|
if [[ $B_CPUINFO == 'true' ]];then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_CPU_DATA=( $( gawk -F': ' '
|
A_CPU_DATA=( $( gawk -F': ' '
|
||||||
{ IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
|
# TAKE STRONGER NOTE: \t+ does NOT always work, MUST be [ \t]+
|
||||||
# TAKE NOTE: \t+ will work for $DIR_CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES!
|
# TAKE NOTE: \t+ will work for $DIR_CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES!
|
||||||
# Therefore PATCH to use [ \t]+ when TESTING!
|
# Therefore PATCH to use [ \t]+ when TESTING!
|
||||||
/^processor\t+:/ { nr = $NF }
|
/^processor[ \t]+:/ {
|
||||||
|
nr = $NF
|
||||||
|
}
|
||||||
|
|
||||||
/^model name|^cpu\t+:/ {
|
/^model name|^cpu\t+:/ {
|
||||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
|
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
|
||||||
|
@ -1442,11 +1464,17 @@ get_cpu_data()
|
||||||
cpu[nr, "speed"] = $NF
|
cpu[nr, "speed"] = $NF
|
||||||
}
|
}
|
||||||
|
|
||||||
/^cache size/ { cpu[nr, "cache"] = $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/ {
|
/vendor_id/ {
|
||||||
gsub(/genuine|authentic/,"",$NF)
|
gsub(/genuine|authentic/,"",$NF)
|
||||||
|
@ -1472,6 +1500,7 @@ get_cpu_data()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
# echo getMainCpu: ${[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
## this is for counting processors and finding HT types
|
## this is for counting processors and finding HT types
|
||||||
|
@ -1485,27 +1514,40 @@ get_cpu_ht_multicore_smp_data()
|
||||||
|
|
||||||
if [[ $B_CPUINFO == 'true' ]]; then
|
if [[ $B_CPUINFO == 'true' ]]; then
|
||||||
A_CPU_TYPE_PCNT_CCNT=( $( gawk '
|
A_CPU_TYPE_PCNT_CCNT=( $( gawk '
|
||||||
BEGIN { FS=": "; i = 0 } {IGNORECASE = 1}
|
BEGIN {
|
||||||
/^processor/ { num_of_processors = $NF + 1 } # counts logical processors, both HT and physical
|
FS=": "
|
||||||
/^cpu cores/ { num_of_cores = $NF } # counts physical cores
|
IGNORECASE = 1
|
||||||
/^physical/ { physical_id[i] = $NF } # array of physical cpus ids
|
i = 0
|
||||||
/^core id/ { core_id[i] = $NF; i++ } # array of core ids
|
|
||||||
{
|
|
||||||
processors = 1
|
processors = 1
|
||||||
cores = 1 # single cores are obviously a Uni-processor
|
cores = 1 # single cores are obviously a Uni-processor
|
||||||
type = "UP"
|
type = "UP"
|
||||||
cpu_temp = 0
|
cpu_temp = 0
|
||||||
core_temp = 0
|
core_temp = 0
|
||||||
|
|
||||||
# look for the largest id number, and assign it
|
|
||||||
for ( j = 0; j <= num_of_processors; j++)
|
|
||||||
{
|
|
||||||
if ( physical[j] > cpu_temp )
|
|
||||||
{
|
|
||||||
cpu_temp = physical[j]
|
|
||||||
}
|
}
|
||||||
if ( core_id[j] > core_temp )
|
# counts logical processors, both HT and physical
|
||||||
{
|
/^processor/ {
|
||||||
|
num_of_processors = $NF + 1
|
||||||
|
}
|
||||||
|
# counts physical cores
|
||||||
|
/^cpu cores/ {
|
||||||
|
num_of_cores = $NF
|
||||||
|
}
|
||||||
|
# array of physical cpus ids
|
||||||
|
/^physical/ {
|
||||||
|
physical_id[i] = $NF
|
||||||
|
}
|
||||||
|
# array of core ids
|
||||||
|
/^core id/ {
|
||||||
|
core_id[i] = $NF
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
# look for the largest id number, and assign it
|
||||||
|
for ( j = 0; j < num_of_processors; j++ ) {
|
||||||
|
if ( physical_id[j] > cpu_temp ) {
|
||||||
|
cpu_temp = physical_id[j]
|
||||||
|
}
|
||||||
|
if ( core_id[j] > core_temp ) {
|
||||||
core_temp = core_id[j]
|
core_temp = core_id[j]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1514,44 +1556,37 @@ get_cpu_ht_multicore_smp_data()
|
||||||
core_count = core_temp + 1
|
core_count = core_temp + 1
|
||||||
|
|
||||||
# looking at logical processor counts over 1, which means either HT, SMP or MCP
|
# looking at logical processor counts over 1, which means either HT, SMP or MCP
|
||||||
if ( num_of_processors > 1 )
|
if ( num_of_processors > 1 ) {
|
||||||
{
|
if ( physical_cpu_count == 1 ) {
|
||||||
if ( physical_cpu_count == 1 )
|
if ( physical_cpu_count == core_count ) {
|
||||||
{
|
|
||||||
if ( physical_cpu_count == core_count )
|
|
||||||
{
|
|
||||||
type = "HT" # this is more than likely a P4 w/HT or an Atom 270
|
type = "HT" # this is more than likely a P4 w/HT or an Atom 270
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if ( core_count == num_of_cores && core_count == num_of_processors) {
|
||||||
if ( core_count == num_of_cores && core_count == num_of_processors)
|
|
||||||
{
|
|
||||||
type = "MCP"
|
type = "MCP"
|
||||||
cores = core_count
|
cores = core_count
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
type = "HT" # this is i7 or Atom 330
|
type = "HT" # this is i7 or Atom 330
|
||||||
cores = core_count
|
cores = core_count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
type = "SMP"
|
type = "SMP"
|
||||||
processors = physical_cpu_count
|
processors = physical_cpu_count
|
||||||
|
|
||||||
if ( num_of_cores > 1 )
|
if ( num_of_cores > 1 ) {
|
||||||
{
|
|
||||||
type = "SMPMC" # processors could be both MCP and SMP
|
type = "SMPMC" # processors could be both MCP and SMP
|
||||||
cores = core_count
|
cores = core_count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print type " " processors " " cores
|
||||||
}
|
}
|
||||||
END { print type " " processors " " cores }
|
|
||||||
' $DIR_CPUINFO ) )
|
' $DIR_CPUINFO ) )
|
||||||
fi
|
fi
|
||||||
|
# echo A_CPU_TYPE_PCNT_CCNT:1 ${A_CPU_TYPE_PCNT_CCNT[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
# for more on distro id, please reference this python thread: http://bugs.python.org/issue1322
|
# for more on distro id, please reference this python thread: http://bugs.python.org/issue1322
|
||||||
|
@ -1612,7 +1647,10 @@ get_distro_data()
|
||||||
distro=$( get_distro_lsb_data )
|
distro=$( get_distro_lsb_data )
|
||||||
else
|
else
|
||||||
distro=$( gawk '
|
distro=$( gawk '
|
||||||
BEGIN { RS="" } {
|
BEGIN {
|
||||||
|
RS=""
|
||||||
|
}
|
||||||
|
{
|
||||||
gsub(/\\[a-z]/, "")
|
gsub(/\\[a-z]/, "")
|
||||||
gsub(/,/, " ")
|
gsub(/,/, " ")
|
||||||
gsub(/^ +| +$/, "")
|
gsub(/^ +| +$/, "")
|
||||||
|
@ -1652,8 +1690,9 @@ get_distro_lsb_data()
|
||||||
|
|
||||||
if [[ $B_LSB_DIR == 'true' ]] && [[ $1 != 'app' ]];then
|
if [[ $B_LSB_DIR == 'true' ]] && [[ $1 != 'app' ]];then
|
||||||
distro=$( gawk -F '=' '
|
distro=$( gawk -F '=' '
|
||||||
|
BEGIN {
|
||||||
{ IGNORECASE=1 }
|
IGNORECASE=1
|
||||||
|
}
|
||||||
# note: adding the spacing directly to variable to make sure distro output is null if not found
|
# note: adding the spacing directly to variable to make sure distro output is null if not found
|
||||||
/^DISTRIB_ID/ {
|
/^DISTRIB_ID/ {
|
||||||
gsub(/^ +| +$/, "", $NF)
|
gsub(/^ +| +$/, "", $NF)
|
||||||
|
@ -1712,7 +1751,9 @@ get_graphics_card_data()
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_GFX_CARD_DATA=( $( echo "$lspci_data" | gawk -F': ' '
|
A_GFX_CARD_DATA=( $( echo "$lspci_data" | gawk -F': ' '
|
||||||
{ IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/vga compatible controller/ {
|
/vga compatible controller/ {
|
||||||
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF)
|
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF)
|
||||||
gsub(/,/, " ", $NF)
|
gsub(/,/, " ", $NF)
|
||||||
|
@ -1740,6 +1781,7 @@ get_graphics_glx_data()
|
||||||
if [[ $B_X_RUNNING == 'true' ]];then
|
if [[ $B_X_RUNNING == 'true' ]];then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_GLX_DATA=( $( glxinfo | gawk -F ': ' '
|
A_GLX_DATA=( $( glxinfo | gawk -F ': ' '
|
||||||
|
# note: function declarations go before BEGIN? It appears so, confirm.
|
||||||
function join(arr, sep) {
|
function join(arr, sep) {
|
||||||
s=""
|
s=""
|
||||||
i=flag=0
|
i=flag=0
|
||||||
|
@ -1752,7 +1794,9 @@ get_graphics_glx_data()
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/opengl renderer/ {
|
/opengl renderer/ {
|
||||||
if ($2 ~ /mesa/) {
|
if ($2 ~ /mesa/) {
|
||||||
# Allow r300 et al, but not the rest
|
# Allow r300 et al, but not the rest
|
||||||
|
@ -1764,8 +1808,12 @@ get_graphics_glx_data()
|
||||||
}
|
}
|
||||||
$2 && a[$2]
|
$2 && a[$2]
|
||||||
}
|
}
|
||||||
/opengl version/ && (f || $2 !~ /mesa/) { $2 && b[$2] }
|
/opengl version/ && (f || $2 !~ /mesa/) {
|
||||||
/direct rendering/ { $2 && c[$2] }
|
$2 && b[$2]
|
||||||
|
}
|
||||||
|
/direct rendering/ {
|
||||||
|
$2 && c[$2]
|
||||||
|
}
|
||||||
|
|
||||||
END {
|
END {
|
||||||
printf("%s\n%s\n%s\n", join(a,", "), join(b,", "), join(c,", "))
|
printf("%s\n%s\n%s\n", join(a,", "), join(b,", "), join(c,", "))
|
||||||
|
@ -1786,17 +1834,24 @@ get_graphics_res_data()
|
||||||
# Added the two ?'s , because the resolution is now reported without spaces around the 'x', as in
|
# Added the two ?'s , because the resolution is now reported without spaces around the 'x', as in
|
||||||
# 1400x1050 instead of 1400 x 1050. Change as of X.org version 1.3.0
|
# 1400x1050 instead of 1400 x 1050. Change as of X.org version 1.3.0
|
||||||
screen_resolution=$( xrandr | gawk '
|
screen_resolution=$( xrandr | gawk '
|
||||||
/\*/ { res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0) }
|
/\*/ {
|
||||||
|
res[++m] = gensub(/^.* ([0-9]+) ?x ?([0-9]+)[_ ].* ([0-9\.]+)\*.*$/,"\\1x\\2@\\3hz","g",$0)
|
||||||
|
}
|
||||||
END {
|
END {
|
||||||
for (n in res) {
|
for (n in res) {
|
||||||
if (res[n] ~ /^[[:digit:]]+x[[:digit:]]+/)
|
if (res[n] ~ /^[[:digit:]]+x[[:digit:]]+/) {
|
||||||
line = line ? line ", " res[n] : res[n]
|
line = line ? line ", " res[n] : res[n]
|
||||||
}
|
}
|
||||||
if (line)
|
}
|
||||||
|
if (line) {
|
||||||
print(line)
|
print(line)
|
||||||
|
}
|
||||||
}' )
|
}' )
|
||||||
if [[ -z $screen_resolution ]];then
|
if [[ -z $screen_resolution ]];then
|
||||||
screen_resolution=$( xdpyinfo | gawk '/dimensions/ { print $2 }' )
|
screen_resolution=$( xdpyinfo | gawk '
|
||||||
|
/dimensions/ {
|
||||||
|
print $2
|
||||||
|
}' )
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
screen_resolution=$( stty -F $( readlink /proc/$PPID/fd/0 ) size | gawk '{ print $2"x"$1 }' )
|
screen_resolution=$( stty -F $( readlink /proc/$PPID/fd/0 ) size | gawk '{ print $2"x"$1 }' )
|
||||||
|
@ -1811,7 +1866,10 @@ get_graphics_agp_data()
|
||||||
|
|
||||||
if [[ B_MODULES_DIR == 'true' ]];then
|
if [[ B_MODULES_DIR == 'true' ]];then
|
||||||
## not used currently
|
## not used currently
|
||||||
agp_module=$( gawk '/agp/ && !/agpgart/ && $3 > 0 { print(gensub(/(.*)_agp.*/,"\\1","g",$1)) }' $DIR_MODULES )
|
agp_module=$( gawk '
|
||||||
|
/agp/ && !/agpgart/ && $3 > 0 {
|
||||||
|
print(gensub(/(.*)_agp.*/,"\\1","g",$1))
|
||||||
|
}' $DIR_MODULES )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1823,7 +1881,9 @@ get_graphics_x_data()
|
||||||
if [[ $B_X_RUNNING == 'true' ]];then
|
if [[ $B_X_RUNNING == 'true' ]];then
|
||||||
# X vendor and version detection.
|
# X vendor and version detection.
|
||||||
x_vendor=$( xdpyinfo | gawk -F': +' '
|
x_vendor=$( xdpyinfo | gawk -F': +' '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/vendor string/ {
|
/vendor string/ {
|
||||||
gsub(/the|inc|foundation|project|corporation/, "", $2)
|
gsub(/the|inc|foundation|project|corporation/, "", $2)
|
||||||
gsub(/,/, " ", $2)
|
gsub(/,/, " ", $2)
|
||||||
|
@ -1838,7 +1898,9 @@ get_graphics_x_data()
|
||||||
x_version=$( xdpyinfo | gawk '/version:/ { print $NF }' )
|
x_version=$( xdpyinfo | gawk '/version:/ { print $NF }' )
|
||||||
if [[ -z $x_version ]];then
|
if [[ -z $x_version ]];then
|
||||||
x_version=$(xdpyinfo | gawk -F': +' '
|
x_version=$(xdpyinfo | gawk -F': +' '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/vendor release number/ {
|
/vendor release number/ {
|
||||||
gsub(/0+$/, "", $2)
|
gsub(/0+$/, "", $2)
|
||||||
gsub(/0+/, ".", $2)
|
gsub(/0+/, ".", $2)
|
||||||
|
@ -1970,7 +2032,9 @@ get_hard_drive_data_advanced()
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
if [[ $B_SCSI_DIR == 'true' ]]; then
|
if [[ $B_SCSI_DIR == 'true' ]]; then
|
||||||
a_temp_scsi=( $( gawk '
|
a_temp_scsi=( $( gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/host/ {
|
/host/ {
|
||||||
getline a[$0]
|
getline a[$0]
|
||||||
getline b[$0]
|
getline b[$0]
|
||||||
|
@ -2059,8 +2123,12 @@ get_memory_data()
|
||||||
local memory=''
|
local memory=''
|
||||||
|
|
||||||
memory=$( gawk '
|
memory=$( gawk '
|
||||||
/^MemTotal:/ { tot = $2 }
|
/^MemTotal:/ {
|
||||||
/^(MemFree|Buffers|Cached):/ { notused+=$2 }
|
tot = $2
|
||||||
|
}
|
||||||
|
/^(MemFree|Buffers|Cached):/ {
|
||||||
|
notused+=$2
|
||||||
|
}
|
||||||
END {
|
END {
|
||||||
used = tot-notused
|
used = tot-notused
|
||||||
printf("%.1f/%.1fMB\n", used/1024, tot/1024)
|
printf("%.1f/%.1fMB\n", used/1024, tot/1024)
|
||||||
|
@ -2076,7 +2144,9 @@ get_module_version_number()
|
||||||
|
|
||||||
if [[ -n $( which modinfo ) ]];then
|
if [[ -n $( which modinfo ) ]];then
|
||||||
module_version=$( modinfo $1 | gawk '
|
module_version=$( modinfo $1 | gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/^version/ {
|
/^version/ {
|
||||||
gsub(/,/, " ", $2)
|
gsub(/,/, " ", $2)
|
||||||
gsub(/^ +| +$/, "", $2)
|
gsub(/^ +| +$/, "", $2)
|
||||||
|
@ -2094,7 +2164,9 @@ get_networking_data()
|
||||||
{
|
{
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_NETWORK_DATA=( $( echo "$lspci_data" | gawk '
|
A_NETWORK_DATA=( $( echo "$lspci_data" | gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/^[0-9a-f:.]+ (ethernet|network) (controller|bridge)/ || /^[0-9a-f:.]+ [^:]+: .*(ethernet|network).*$/ {
|
/^[0-9a-f:.]+ (ethernet|network) (controller|bridge)/ || /^[0-9a-f:.]+ [^:]+: .*(ethernet|network).*$/ {
|
||||||
nic=gensub(/^[0-9a-f:.]+ [^:]+: (.+)$/,"\\1","g",$0)
|
nic=gensub(/^[0-9a-f:.]+ [^:]+: (.+)$/,"\\1","g",$0)
|
||||||
gsub(/realtek semiconductor/, "Realtek", nic)
|
gsub(/realtek semiconductor/, "Realtek", nic)
|
||||||
|
@ -2179,7 +2251,9 @@ get_networking_local_ip_data()
|
||||||
if [[ $B_IFCONFIG == 'true' ]];then
|
if [[ $B_IFCONFIG == 'true' ]];then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_INTERFACES_DATA=( $( $DIR_IFCONFIG | gawk '
|
A_INTERFACES_DATA=( $( $DIR_IFCONFIG | gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
$0 !~ /^lo/ {
|
$0 !~ /^lo/ {
|
||||||
# not clear on why inet is coming through, but this gets rid of it
|
# not clear on why inet is coming through, but this gets rid of it
|
||||||
# as first line item.
|
# as first line item.
|
||||||
|
@ -2228,7 +2302,9 @@ get_partition_data()
|
||||||
## note: by subtracting from the last field number NF, we avoid a subtle issue with LVM df output, where if
|
## note: by subtracting from the last field number NF, we avoid a subtle issue with LVM df output, where if
|
||||||
## the first field is too long, it will occupy its own line, this way we are getting only the needed data
|
## the first field is too long, it will occupy its own line, this way we are getting only the needed data
|
||||||
A_PARTITION_DATA=( $( df -h -T --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 | gawk '
|
A_PARTITION_DATA=( $( df -h -T --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 | gawk '
|
||||||
BEGIN { IGNORECASE=1 }
|
BEGIN {
|
||||||
|
IGNORECASE=1
|
||||||
|
}
|
||||||
/\/$|\/boot$|\/var$|\/home$|\/tmp$|\/usr$/ && ! /aufs/ {
|
/\/$|\/boot$|\/var$|\/home$|\/tmp$|\/usr$/ && ! /aufs/ {
|
||||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main"
|
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main"
|
||||||
}
|
}
|
||||||
|
@ -2280,7 +2356,10 @@ calculate_multicore_data()
|
||||||
fi
|
fi
|
||||||
# handle weird error cases where it's not a number
|
# handle weird error cases where it's not a number
|
||||||
if [[ -n $( egrep '^[0-9\.,]+$' <<< $string_number ) ]];then
|
if [[ -n $( egrep '^[0-9\.,]+$' <<< $string_number ) ]];then
|
||||||
string_number=$( echo $string_number $2 | gawk '{total = $1*$2; print total}' )
|
string_number=$( echo $string_number $2 | gawk '{
|
||||||
|
total = $1*$2
|
||||||
|
print total
|
||||||
|
}' )
|
||||||
elif [[ $string_number == '' ]];then
|
elif [[ $string_number == '' ]];then
|
||||||
string_number='Not Available'
|
string_number='Not Available'
|
||||||
else
|
else
|
||||||
|
@ -2995,9 +3074,9 @@ print_system_data()
|
||||||
if [[ $B_SHOW_HOST == 'true' ]];then
|
if [[ $B_SHOW_HOST == 'true' ]];then
|
||||||
system_data=$( create_print_line "System:" "${C1}Host${C2} $host_name ${C1}Kernel${C2}" )
|
system_data=$( create_print_line "System:" "${C1}Host${C2} $host_name ${C1}Kernel${C2}" )
|
||||||
else
|
else
|
||||||
system_data=$( create_print_line "System:" "${C1}Kernel${C2} ${CN}" )
|
system_data=$( create_print_line "System:" "${C1}Kernel${C2}" )
|
||||||
fi
|
fi
|
||||||
system_data="$system_data ${C2} $current_kernel $bits ${C1}Distro${C2} $distro"
|
system_data="$system_data $current_kernel $bits ${C1}Distro${C2} $distro"
|
||||||
print_screen_output "$system_data"
|
print_screen_output "$system_data"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue