New version, new tarball. This fixes a subtle gawk issue that could in some systems make -G

hang endlessly.

Also started on more optimizing, getting rid of as many subshells as possible.
This commit is contained in:
Harald Hope 2017-07-29 12:38:34 -07:00
parent b2d136761a
commit a29641babe
2 changed files with 145 additions and 135 deletions

265
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.3.27
#### Date: 2017-07-28
#### Version: 2.3.28
#### Date: 2017-07-29
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -501,10 +501,11 @@ WAN_IP_URL='http://smxi.org/opt/ip.php'
KONVI_CFG="konversation/scripts/$SCRIPT_NAME.conf" # relative path to $(kde-config --path data)
### INITIALIZE VARIABLES NULL ###
ARCH='' # cpu microarchitecture
BSD_TYPE=''
BSD_VERSION=
CMDL_MAX=''
CPU_COUNT_ALPHA=''
DEV_DISK_ID=''
DEV_DISK_LABEL=''
DEV_DISK_MAPPER=''
@ -931,7 +932,7 @@ initialize_data()
elif type -p curl &>/dev/null;then
DOWNLOADER='curl'
NO_SSL=' --insecure'
elif [[ $BSD_VERSION == 'openbsd' && -n $( type -p ftp ) ]];then
elif [[ $BSD_VERSION == 'openbsd' ]] && type -p ftp &>/dev/null;then
DOWNLOADER='ftp'
else
DOWNLOADER='no-downloader'
@ -1763,7 +1764,7 @@ debug_data_collector()
local xiin_url="https://github.com/smxi/inxi/raw/xiin/$xiin_file"
local Line='-------------------------' root_string=''
local start_directory=$( pwd )
local host=$( tr '[A-Z]' '[a-z]' <<< "$HOSTNAME" )
local host="${HOSTNAME,,}"
local downloader_error=0 debug_i=''
if [[ $B_DEBUG_I == 'true' ]];then
@ -3439,7 +3440,7 @@ get_start_client()
Irc_Client_Path=$( readlink /proc/$PPID/exe )
# Irc_Client_Path=$( ps -p $PPID | gawk '!/[[:space:]]*PID/ {print $5}' )
# echo $( ps -p $PPID )
irc_client_path_lower=$( tr '[A-Z]' '[a-z]' <<< $Irc_Client_Path )
irc_client_path_lower=${Irc_Client_Path,,}
App_Working_Name=${irc_client_path_lower##*/}
# handles the xchat/sh/bash/dash cases, and the konversation/perl cases, where clients
# report themselves as perl or unknown shell. IE: when konversation starts inxi
@ -3456,7 +3457,7 @@ get_start_client()
fi
if [[ -n $pppid && -f /proc/$pppid/exe ]];then
Irc_Client_Path="$( readlink /proc/$pppid/exe )"
irc_client_path_lower=$( tr '[A-Z]' '[a-z]' <<< $Irc_Client_Path )
irc_client_path_lower=${Irc_Client_Path,,}
App_Working_Name=${irc_client_path_lower##*/}
B_Non_Native_App='true'
fi
@ -3498,7 +3499,7 @@ get_start_client()
if [[ -n $App_Working_Name ]];then
Irc_Client_Path=$App_Working_Name
irc_client_path_lower=$( tr '[A-Z]' '[a-z]' <<< $Irc_Client_Path )
irc_client_path_lower=${Irc_Client_Path,,}
App_Working_Name=${irc_client_path_lower##*/}
B_Non_Native_App='false'
get_irc_client_version
@ -4358,110 +4359,108 @@ get_battery_data()
get_cpu_architecture()
{
eval $LOGFS
local arch=""
case $1 in
amd)
case $2 in
4)
case $3 in
3|7|8|9|A)arch='Am486';;
E|F)arch='Am5x86';;
3|7|8|9|A)ARCH='Am486';;
E|F)ARCH='Am5x86';;
esac
;;
5)
case $3 in
0|1|2|3)arch='K5';;
6|7)arch='K6';;
8)arch='K6-2';;
9|D)arch='K6-3';;
0|1|2|3)ARCH='K5';;
6|7)ARCH='K6';;
8)ARCH='K6-2';;
9|D)ARCH='K6-3';;
esac
;;
6)
case $3 in
1|2)arch='K7';;
3|4)arch='K7 Thunderbird';;
6|7|8|A)arch='K7 Palomino+';;
*)arch='K7';;
1|2)ARCH='K7';;
3|4)ARCH='K7 Thunderbird';;
6|7|8|A)ARCH='K7 Palomino+';;
*)ARCH='K7';;
esac
;;
F)
case $3 in
4|5|7|8|B|C|E|F|14|15|17|18|1B|1C|1F)arch='K8';;
21|23|24|25|27|28|2C|2F)arch='K8 rev.E';;
41|43|48|4B|4C|4F|5D|5F|68|6B|6C|6F|7C|7F|C1)arch='K8 rev.F+';;
*)arch='K8';;
4|5|7|8|B|C|E|F|14|15|17|18|1B|1C|1F)ARCH='K8';;
21|23|24|25|27|28|2C|2F)ARCH='K8 rev.E';;
41|43|48|4B|4C|4F|5D|5F|68|6B|6C|6F|7C|7F|C1)ARCH='K8 rev.F+';;
*)ARCH='K8';;
esac
;;
10)
case $3 in
2|4|5|6|8|9|A)arch='K10';;
*)arch='K10';;
2|4|5|6|8|9|A)ARCH='K10';;
*)ARCH='K10';;
esac
;;
11)
case $3 in
3)arch='K8 rev.E+';;
3)ARCH='K8 rev.E+';;
esac
;;
12)
case $3 in
1)arch='K10';;
*)arch='K10';;
1)ARCH='K10';;
*)ARCH='K10';;
esac
;;
14)
case $3 in
1|2)arch='Bobcat';;
*)arch='Bobcat';;
1|2)ARCH='Bobcat';;
*)ARCH='Bobcat';;
esac
;;
15)
case $3 in
1)arch='Bulldozer';;
2|10|13)arch='Piledriver';;
30)arch='Steamroller';;
*)arch='Bulldozer';;
1)ARCH='Bulldozer';;
2|10|13)ARCH='Piledriver';;
30)ARCH='Steamroller';;
*)ARCH='Bulldozer';;
esac
;;
16)
case $3 in
0)arch='Jaguar';;
30)arch='Puma';;
*)arch='Jaguar';;
0)ARCH='Jaguar';;
30)ARCH='Puma';;
*)ARCH='Jaguar';;
esac
;;
17)
case $3 in
1)arch='Zen';;
*)arch='Zen';;
1)ARCH='Zen';;
*)ARCH='Zen';;
esac
;;
esac
;;
arm)
if [[ "$2" != '' ]];then
arch="ARMv$2"
ARCH="ARMv$2"
else
arch='ARM'
ARCH='ARM'
fi
;;
centaur)
case $2 in
5)
case $3 in
4)arch='WinChip C6';;
8)arch='WinChip 2';;
9)arch='WinChip 3';;
4)ARCH='WinChip C6';;
8)ARCH='WinChip 2';;
9)ARCH='WinChip 3';;
esac
;;
6)
case $3 in
6)arch='WinChip-based';;
7|8)arch='C3';;
9)arch='C3-2';;
A|D)arch='C7';;
F)arch='Isaiah';;
6)ARCH='WinChip-based';;
7|8)ARCH='C3';;
9)ARCH='C3-2';;
A|D)ARCH='C7';;
F)ARCH='Isaiah';;
esac
;;
esac
@ -4470,56 +4469,55 @@ get_cpu_architecture()
case $2 in
4)
case $3 in
0|1|2|3|4|5|6|7|8|9)arch='486';;
0|1|2|3|4|5|6|7|8|9)ARCH='486';;
esac
;;
5)
case $3 in
1|2|3|7)arch='P5';;
4|8)arch='P5';; # MMX
9)arch='Quark';;
1|2|3|7)ARCH='P5';;
4|8)ARCH='P5';; # MMX
9)ARCH='Quark';;
esac
;;
6)
case $3 in
1)arch='P6 Pro';;
3|5|6)arch='P6 II';;
7|8|A|B)arch='P6 III';;
9|15)arch='Mobile';; # pentium M
D)arch='Mobile Dothan';; # Pentium M
E)arch='Core Yonah';;
F)arch='Core 2';;
17|1D)arch='Core Penryn';;
1A|1E|2E)arch='Nehalem';;
1C|35|36)arch='Bonnell';;
25|2C|2F)arch='Westmere';;
26|27)arch='Bonnell';;
2A|2D)arch='Sandy Bridge';;
37|4A|4D)arch='Silvermont';;
3A|3E)arch='Ivy Bridge';;
3C|3F|45|46)arch='Haswell';;
3D)arch='Broadwell';;
4E)arch='Skylake';;
1)ARCH='P6 Pro';;
3|5|6)ARCH='P6 II';;
7|8|A|B)ARCH='P6 III';;
9|15)ARCH='Mobile';; # pentium M
D)ARCH='Mobile Dothan';; # Pentium M
E)ARCH='Core Yonah';;
F)ARCH='Core 2';;
17|1D)ARCH='Core Penryn';;
1A|1E|2E)ARCH='Nehalem';;
1C|35|36)ARCH='Bonnell';;
25|2C|2F)ARCH='Westmere';;
26|27)ARCH='Bonnell';;
2A|2D)ARCH='Sandy Bridge';;
37|4A|4D)ARCH='Silvermont';;
3A|3E)ARCH='Ivy Bridge';;
3C|3F|45|46)ARCH='Haswell';;
3D)ARCH='Broadwell';;
4E)ARCH='Skylake';;
esac
;;
B)
case $3 in
1)arch='Knights Corner';;
1)ARCH='Knights Corner';;
esac
;;
F)
case $3 in
0|1|2)arch='Netburst';;
3|4|6)arch='Netburst Prescott';; # Nocona
*)arch='Netburst';;
0|1|2)ARCH='Netburst';;
3|4|6)ARCH='Netburst Prescott';; # Nocona
*)ARCH='Netburst';;
esac
;;
esac
;;
esac
echo $arch
log_function_data "ARCH: $ARCH"
eval $LOGFE
}
@ -4528,7 +4526,7 @@ get_cpu_architecture()
get_cpu_core_count()
{
eval $LOGFS
local cpu_physical_count='' cpu_core_count='' cpu_type='' cpu_alpha_count='' cores_per_cpu=''
local cpu_physical_count='' cpu_core_count='' cpu_type='' cores_per_cpu=''
local array_data=''
if [[ $B_CPUINFO_FILE == 'true' ]]; then
@ -4541,11 +4539,11 @@ get_cpu_core_count()
cpu_type=${A_CPU_TYPE_PCNT_CCNT[0]}
# match the numberic value to an alpha value
cpu_alpha_count=$( get_cpu_core_count_alpha "$cpu_core_count" )
get_cpu_core_count_alpha "$cpu_core_count"
# create array, core count integer; core count string
# A_CPU_CORE_DATA=( "$cpu_core_count" "$cpu_alpha_count Core$cpu_type" )
array_data="$cpu_physical_count,$cpu_alpha_count,$cpu_type,$cpu_core_count"
# A_CPU_CORE_DATA=( "$cpu_core_count" "$CPU_COUNT_ALPHA Core$cpu_type" )
array_data="$cpu_physical_count,$CPU_COUNT_ALPHA,$cpu_type,$cpu_core_count"
IFS=','
A_CPU_CORE_DATA=( $array_data )
IFS="$ORIGINAL_IFS"
@ -4575,7 +4573,7 @@ get_cpu_core_count()
}' <<< "$Sysctl_a_Data" )
if [[ -n $( grep -E '^[0-9]+$' <<< "$cpu_core_count" ) ]];then
cpu_alpha_count=$( get_cpu_core_count_alpha "$cpu_core_count" )
get_cpu_core_count_alpha "$cpu_core_count"
if [[ $cpu_core_count -gt 1 ]];then
cpu_type='-SMP-'
else
@ -4592,7 +4590,7 @@ get_cpu_core_count()
else
cpu_physical_count=1
fi
array_data="$cpu_physical_count,$cpu_alpha_count,$cpu_type,$cpu_core_count"
array_data="$cpu_physical_count,$CPU_COUNT_ALPHA,$cpu_type,$cpu_core_count"
IFS=','
A_CPU_CORE_DATA=( $array_data )
IFS="$ORIGINAL_IFS"
@ -4607,23 +4605,21 @@ get_cpu_core_count()
get_cpu_core_count_alpha()
{
eval $LOGFS
local cpu_alpha_count=''
case $1 in
1) cpu_alpha_count='Single';;
2) cpu_alpha_count='Dual';;
3) cpu_alpha_count='Triple';;
4) cpu_alpha_count='Quad';;
5) cpu_alpha_count='Penta';;
6) cpu_alpha_count='Hexa';;
7) cpu_alpha_count='Hepta';;
8) cpu_alpha_count='Octa';;
9) cpu_alpha_count='Ennea';;
10) cpu_alpha_count='Deca';;
*) cpu_alpha_count='Multi';;
1) CPU_COUNT_ALPHA='Single';;
2) CPU_COUNT_ALPHA='Dual';;
3) CPU_COUNT_ALPHA='Triple';;
4) CPU_COUNT_ALPHA='Quad';;
5) CPU_COUNT_ALPHA='Penta';;
6) CPU_COUNT_ALPHA='Hexa';;
7) CPU_COUNT_ALPHA='Hepta';;
8) CPU_COUNT_ALPHA='Octa';;
9) CPU_COUNT_ALPHA='Ennea';;
10) CPU_COUNT_ALPHA='Deca';;
*) CPU_COUNT_ALPHA='Multi';;
esac
echo $cpu_alpha_count
log_function_data "CPU_COUNT_ALPHA: $CPU_COUNT_ALPHA"
eval $LOGFE
}
@ -4881,7 +4877,8 @@ get_cpu_data_bsd()
bSwitchFs="false"
min=0
max=0
type=""
# these can be found in dmesg.boot just like in cpuinfo except all in one row
type=""
family=""
model_nu=""
rev=""
@ -5485,7 +5482,7 @@ get_desktop_environment()
version="$version "
fi
desktop_environment="WM2"
elif [[ -n $( grep -is 'herbstluftwm' <<< "$xprop_root" ) ]];then
elif [[ -z "${xprop_root/*herbstluftwm*/}" ]];then
version=$( get_program_version 'herbstluftwm' '^herbstluftwm' 'NF' )
if [[ -n $version ]];then
version="$version "
@ -5497,22 +5494,22 @@ get_desktop_environment()
# note that gawk is going to exit after first occurrence of search string, so no need for extra
# http://www.xwinman.org/ for more possible wm
if [[ -z $desktop_environment ]];then
if [[ -n $( grep -is 'fvwm-crystal' <<< "$Ps_aux_Data" ) ]];then
if [[ -z "${Ps_aux_Data/*fvwm-crystal*/}" ]];then
version=$( get_program_version 'fvwm' '^fvwm' '2' )
desktop_environment='FVWM-Crystal'
elif [[ -n $( grep -is 'fvwm' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*fvwm*/}" ]];then
version=$( get_program_version 'fvwm' '^fvwm' '2' )
desktop_environment='FVWM'
elif [[ -n $( grep -is 'pekwm' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*pekwm*/}" ]];then
version=$( get_program_version 'pekwm' '^pekwm' '3' )
desktop_environment='pekwm'
elif [[ -n $( grep -is 'awesome' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*awesome*/}" ]];then
version=$( get_program_version 'awesome' '^awesome' '2' )
desktop_environment='Awesome'
elif [[ -n $( grep -is 'scrotwm' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*scrotwm*/}" ]];then
version=$( get_program_version 'scrotwm' '^welcome.*scrotwm' '4' )
desktop_environment='Scrotwm' # no --version for this one
elif [[ -n $( grep -is 'spectrwm' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*spectrwm*/}" ]];then
version=$( get_program_version 'spectrwm' '^spectrwm.*welcome.*spectrwm' '5' )
desktop_environment='Spectrwm' # no --version for this one
elif [[ -n $( grep -Eis '([[:space:]]|/)twm' <<< "$Ps_aux_Data" ) ]];then
@ -5520,20 +5517,20 @@ get_desktop_environment()
elif [[ -n $( grep -Eis '([[:space:]]|/)dwm' <<< "$Ps_aux_Data" ) ]];then
version=$( get_program_version 'dwm' '^dwm' '1' )
desktop_environment='dwm'
elif [[ -n $( grep -is 'wmii2' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*wmii2*/}" ]];then
version=$( get_program_version 'wmii2' '^wmii2' '1' )
desktop_environment='wmii2'
# note: in debian at least, wmii is actuall wmii3
elif [[ -n $( grep -is 'wmii' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*wmii*/}" ]];then
version=$( get_program_version 'wmii' '^wmii' '1' )
desktop_environment='wmii'
elif [[ -n $( grep -Eis '([[:space:]]|/)jwm' <<< "$Ps_aux_Data" ) ]];then
version=$( get_program_version 'jwm' '^jwm' '2' )
desktop_environment='JWM'
elif [[ -n $( grep -is 'sawfish' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*sawfish*/}" ]];then
version=$( get_program_version 'sawfish' '^sawfish' '3' )
desktop_environment='Sawfish'
elif [[ -n $( grep -is 'afterstep' <<< "$Ps_aux_Data" ) ]];then
elif [[ -z "${Ps_aux_Data/*afterstep*/}" ]];then
version=$( get_program_version 'afterstep' '^afterstep' '3' )
desktop_environment='AfterStep'
fi
@ -6564,8 +6561,7 @@ get_graphics_card_data()
card=$NF
busId=gensub(/^([0-9a-f:\.]+) (.+)$/,"\\1",1,$1)
trueCard=gensub(/(.*)\.([0-9]+)$/,"\\2",1,busId)
while (!/^$/) {
getline
while ( getline && !/^$/) {
if ( $1 ~ /Kernel driver in use/ ){
driver=$2
}
@ -6930,39 +6926,38 @@ get_graphics_display_compositor()
{
eval $LOGFS
local compositor=''
local ps_aux="$( ps aux)"
if [[ -n $( grep 'mutter' <<< "$ps_aux" ) ]];then
if [[ -z "${Ps_aux_Data/*mutter*/}" ]];then
compositor='mutter'
elif [[ -n $( grep 'gnome-shell' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*gnome-shell*/}" ]];then
compositor='gnome-shell'
elif [[ -n $( grep 'kwin' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*kwin*/}" ]];then
compositor='kwin'
elif [[ -n $( grep 'moblin' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*moblin*/}" ]];then
compositor='moblin'
elif [[ -n $( grep 'kmscon' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*kmscon*/}" ]];then
compositor='kmscon'
elif [[ -n $( grep 'sway' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*sway*/}" ]];then
compositor='sway'
elif [[ -n $( grep 'grefson' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*grefson*/}" ]];then
compositor='grefson'
elif [[ -n $( grep 'westford' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*westford*/}" ]];then
compositor='westford'
elif [[ -n $( grep 'rustland' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*rustland*/}" ]];then
compositor='rustland'
elif [[ -n $( grep 'fireplace' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*fireplace*/}" ]];then
compositor='fireplace'
elif [[ -n $( grep 'wayhouse' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*wayhouse*/}" ]];then
compositor='wayhouse'
elif [[ -n $( grep 'weston' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*weston*/}" ]];then
compositor='weston'
elif [[ -n $( grep 'compton' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*compton*/}" ]];then
compositor='compton'
elif [[ -n $( grep 'compiz' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*compiz*/}" ]];then
compositor='compiz'
elif [[ -n $( grep 'swc' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*swc*/}" ]];then
compositor='swc'
elif [[ -n $( grep 'dwc' <<< "$ps_aux" ) ]];then
elif [[ -z "${Ps_aux_Data/*dwc*/}" ]];then
compositor='dwc'
fi
@ -12798,15 +12793,15 @@ print_cpu_data()
IFS="$ORIGINAL_IFS"
if [[ $B_EXTRA_DATA == 'true' && ${a_cpu_info[3]} != '' ]];then
arch=$( get_cpu_architecture "${a_cpu_info[3]}" "${a_cpu_info[4]}" "${a_cpu_info[5]}" )
get_cpu_architecture "${a_cpu_info[3]}" "${a_cpu_info[4]}" "${a_cpu_info[5]}"
# note: arm model names usually say what revision it is
if [[ ${a_cpu_info[3]} != 'arm' && "${a_cpu_info[6]}" != '' ]];then
if [[ -n "${arch/*rev*/}" ]];then
if [[ -n "${ARCH/*rev*/}" ]];then
rev=" rev.${a_cpu_info[6]}"
fi
fi
if [[ "$arch" != '' ]];then
arch=" ($arch$rev)"
if [[ "$ARCH" != '' ]];then
arch=" ($ARCH$rev)"
arm='' # note: to avoid redundant output, only show this without -x option
fi
fi
@ -13869,7 +13864,7 @@ print_module_version()
if [[ -z $( grep -E '^snd' <<< $modules ) ]];then
prefix='snd_' # sound modules start with snd_
fi
modules=$( tr '[A-Z]' '[a-z]' <<< "$modules" )
modules="${modules,,}"
modules=${modules//-/_}
# special intel processing, generally no version info though
if [[ $modules == 'hda intel' ]];then

View file

@ -1,3 +1,18 @@
=====================================================================================
Version: 2.3.28
Patch Version: 00
Script Date: 2017-07-29
-----------------------------------
Changes:
-----------------------------------
New version, new tarball. This fixes a subtle gawk issue that could in some systems make -G
hang endlessly.
Also started on more optimizing, getting rid of as many subshells as possible.
-----------------------------------
-- Harald Hope - Sat, 29 Jul 2017 12:37:27 -0700
=====================================================================================
Version: 2.3.27
Patch Version: 00