mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
changed the DIR_ to FILE_ to better indicate they are files, updated app tests to use inxi default of: type -p
fine tuned some output stuff for -s sensors output
This commit is contained in:
parent
3dd88bf16c
commit
b4f59b5296
96
inxi
96
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.0.97-b1
|
#### version: 1.0.98-b1
|
||||||
#### Date: 27 July 2009
|
#### Date: 27 July 2009
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -237,16 +237,15 @@ B_MOUNTS_DIR='false'
|
||||||
B_PARTITIONS_DIR='false' #
|
B_PARTITIONS_DIR='false' #
|
||||||
|
|
||||||
### Directory's used when present
|
### Directory's used when present
|
||||||
DIR_CPUINFO='/proc/cpuinfo'
|
FILE_CPUINFO='/proc/cpuinfo'
|
||||||
DIR_MEMINFO='/proc/meminfo'
|
FILE_MEMINFO='/proc/meminfo'
|
||||||
DIR_ASOUND_DEVICE='/proc/asound/cards'
|
FILE_ASOUND_DEVICE='/proc/asound/cards'
|
||||||
DIR_ASOUND_VERSION='/proc/asound/version'
|
FILE_ASOUND_VERSION='/proc/asound/version'
|
||||||
DIR_LSB_RELEASE='/etc/lsb-release'
|
FILE_LSB_RELEASE='/etc/lsb-release'
|
||||||
DIR_SCSI='/proc/scsi/scsi'
|
FILE_SCSI='/proc/scsi/scsi'
|
||||||
DIR_MODULES='/proc/modules' #
|
FILE_MODULES='/proc/modules'
|
||||||
DIR_MOUNTS='/proc/mounts'
|
FILE_MOUNTS='/proc/mounts'
|
||||||
DIR_PARTITIONS='/proc/partitions' #
|
FILE_PARTITIONS='/proc/partitions'
|
||||||
DIR_IFCONFIG='/sbin/ifconfig'
|
|
||||||
|
|
||||||
### Variable initializations: constants
|
### Variable initializations: constants
|
||||||
DCOPOBJ="default"
|
DCOPOBJ="default"
|
||||||
|
@ -515,41 +514,38 @@ initialize_script_data()
|
||||||
error_handler 6
|
error_handler 6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_CPUINFO ]]; then
|
if [[ -e $FILE_CPUINFO ]]; then
|
||||||
B_CPUINFO='true'
|
B_CPUINFO='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_MEMINFO ]];then
|
if [[ -e $FILE_MEMINFO ]];then
|
||||||
B_MEMINFO='true'
|
B_MEMINFO='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_ASOUND_DEVICE ]];then
|
if [[ -e $FILE_ASOUND_DEVICE ]];then
|
||||||
B_ASOUND_CARDS='true'
|
B_ASOUND_CARDS='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_ASOUND_VERSION ]];then
|
if [[ -e $FILE_ASOUND_VERSION ]];then
|
||||||
B_ASOUND_VERSION='true'
|
B_ASOUND_VERSION='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f $DIR_LSB_RELEASE ]];then
|
if [[ -f $FILE_LSB_RELEASE ]];then
|
||||||
B_LSB_DIR='true'
|
B_LSB_DIR='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_SCSI ]];then
|
if [[ -e $FILE_SCSI ]];then
|
||||||
B_SCSI_DIR='true'
|
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
|
||||||
if [[ -x ifconfig ]]; then
|
if [[ -n $( type -p ifconfig ) ]]; then
|
||||||
B_IFCONFIG='true'
|
|
||||||
DIR_IFCONFIG='ifconfig' # change from full path to use $PATH
|
|
||||||
elif [[ -x $DIR_IFCONFIG ]];then
|
|
||||||
B_IFCONFIG='true'
|
B_IFCONFIG='true'
|
||||||
else
|
else
|
||||||
A_INTERFACES_DATA=( "Interfaces tool requires missing app: $DIR_IFCONFIG" )
|
A_INTERFACES_DATA=( "Interfaces tool requires missing app: ifconfig" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $( which sensors ) ]];then
|
if [[ -n $( type -p sensors ) ]];then
|
||||||
B_SENSORS='true'
|
B_SENSORS='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -557,15 +553,15 @@ initialize_script_data()
|
||||||
B_X_RUNNING='true'
|
B_X_RUNNING='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_MODULES ]];then
|
if [[ -e $FILE_MODULES ]];then
|
||||||
B_MODULES_DIR='true'
|
B_MODULES_DIR='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_MOUNTS ]];then
|
if [[ -e $FILE_MOUNTS ]];then
|
||||||
B_MOUNTS_DIR='true'
|
B_MOUNTS_DIR='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e $DIR_PARTITIONS ]];then
|
if [[ -e $FILE_PARTITIONS ]];then
|
||||||
B_PARTITIONS_DIR='true'
|
B_PARTITIONS_DIR='true'
|
||||||
fi
|
fi
|
||||||
# gfx output will require this flag
|
# gfx output will require this flag
|
||||||
|
@ -1648,8 +1644,8 @@ get_audio_data()
|
||||||
if ( driver != "" ){
|
if ( driver != "" ){
|
||||||
print driver
|
print driver
|
||||||
}
|
}
|
||||||
}' $DIR_ASOUND_DEVICE )
|
}' $FILE_ASOUND_DEVICE )
|
||||||
log_function_data 'cat' "$DIR_ASOUND_DEVICE"
|
log_function_data 'cat' "$FILE_ASOUND_DEVICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# this is to safeguard against line breaks from results > 1, which if inserted into following
|
# this is to safeguard against line breaks from results > 1, which if inserted into following
|
||||||
|
@ -1739,7 +1735,7 @@ get_audio_data()
|
||||||
if ( card != "" ){
|
if ( card != "" ){
|
||||||
print card","driver
|
print card","driver
|
||||||
}
|
}
|
||||||
}' $DIR_ASOUND_DEVICE ) )
|
}' $FILE_ASOUND_DEVICE ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# alsa usb detection by damentz
|
# alsa usb detection by damentz
|
||||||
|
@ -1800,8 +1796,8 @@ get_audio_alsa_data()
|
||||||
if ( $0 != "" ){
|
if ( $0 != "" ){
|
||||||
print $0
|
print $0
|
||||||
}
|
}
|
||||||
}' $DIR_ASOUND_VERSION )
|
}' $FILE_ASOUND_VERSION )
|
||||||
log_function_data 'cat' "$DIR_ASOUND_VERSION"
|
log_function_data 'cat' "$FILE_ASOUND_VERSION"
|
||||||
fi
|
fi
|
||||||
echo "$alsa_data"
|
echo "$alsa_data"
|
||||||
log_function_data "alsa_data: $alsa_data"
|
log_function_data "alsa_data: $alsa_data"
|
||||||
|
@ -1857,7 +1853,7 @@ get_cpu_data()
|
||||||
IGNORECASE=1
|
IGNORECASE=1
|
||||||
}
|
}
|
||||||
# TAKE STRONGER NOTE: \t+ does NOT always work, MUST be [ \t]+
|
# 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 $FILE_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]+:/ {
|
/^processor[ \t]+:/ {
|
||||||
nr = $NF
|
nr = $NF
|
||||||
|
@ -1922,8 +1918,8 @@ get_cpu_data()
|
||||||
else {
|
else {
|
||||||
printf("%s %s\n", max, "Mhz")
|
printf("%s %s\n", max, "Mhz")
|
||||||
}
|
}
|
||||||
}' $DIR_CPUINFO ) )
|
}' $FILE_CPUINFO ) )
|
||||||
log_function_data 'cat' "$DIR_CPUINFO"
|
log_function_data 'cat' "$FILE_CPUINFO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
@ -2014,7 +2010,7 @@ get_cpu_ht_multicore_smp_data()
|
||||||
}
|
}
|
||||||
print type " " physical_cpu_count " " core_count
|
print type " " physical_cpu_count " " core_count
|
||||||
}
|
}
|
||||||
' $DIR_CPUINFO ) )
|
' $FILE_CPUINFO ) )
|
||||||
fi
|
fi
|
||||||
log_function_data "A_CPU_TYPE_PCNT_CCNT: ${A_CPU_TYPE_PCNT_CCNT[@]}"
|
log_function_data "A_CPU_TYPE_PCNT_CCNT: ${A_CPU_TYPE_PCNT_CCNT[@]}"
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
|
@ -2066,7 +2062,7 @@ get_distro_data()
|
||||||
# this handles case where only one release/version file was found, and it's lsb-release. This would
|
# this handles case where only one release/version file was found, and it's lsb-release. This would
|
||||||
# never apply for ubuntu or debian, which will filter down to the following conditions. In general
|
# never apply for ubuntu or debian, which will filter down to the following conditions. In general
|
||||||
# if there's a specific distro release file available, that's to be preferred, but this is a good backup.
|
# if there's a specific distro release file available, that's to be preferred, but this is a good backup.
|
||||||
elif [[ -n $distro_file && -f $DIR_LSB_RELEASE && " $DISTROS_LSB_GOOD" == *" $distro_file "* ]];then
|
elif [[ -n $distro_file && -f $FILE_LSB_RELEASE && " $DISTROS_LSB_GOOD" == *" $distro_file "* ]];then
|
||||||
distro=$( get_distro_lsb_data )
|
distro=$( get_distro_lsb_data )
|
||||||
elif [[ $distro_file == 'lsb-release' ]];then
|
elif [[ $distro_file == 'lsb-release' ]];then
|
||||||
distro=$( get_distro_lsb_data )
|
distro=$( get_distro_lsb_data )
|
||||||
|
@ -2155,8 +2151,8 @@ get_distro_lsb_data()
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
print distroId distroRelease distroCodename
|
print distroId distroRelease distroCodename
|
||||||
}' $DIR_LSB_RELEASE )
|
}' $FILE_LSB_RELEASE )
|
||||||
log_function_data 'cat' "$DIR_LSB_RELEASE"
|
log_function_data 'cat' "$FILE_LSB_RELEASE"
|
||||||
fi
|
fi
|
||||||
# this is HORRIBLY slow, but I don't know why, it runs fast in shell
|
# this is HORRIBLY slow, but I don't know why, it runs fast in shell
|
||||||
# if [[ -n $( which lsb_release ) && $1 == 'app' ]];then
|
# if [[ -n $( which lsb_release ) && $1 == 'app' ]];then
|
||||||
|
@ -2328,8 +2324,8 @@ get_graphics_agp_data()
|
||||||
agp_module=$( gawk '
|
agp_module=$( gawk '
|
||||||
/agp/ && !/agpgart/ && $3 > 0 {
|
/agp/ && !/agpgart/ && $3 > 0 {
|
||||||
print(gensub(/(.*)_agp.*/,"\\1","g",$1))
|
print(gensub(/(.*)_agp.*/,"\\1","g",$1))
|
||||||
}' $DIR_MODULES )
|
}' $FILE_MODULES )
|
||||||
log_function_data 'cat' "$DIR_MODULES"
|
log_function_data 'cat' "$FILE_MODULES"
|
||||||
fi
|
fi
|
||||||
log_function_data "agp_module: $agp_module"
|
log_function_data "agp_module: $agp_module"
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
|
@ -2464,8 +2460,8 @@ get_hdd_data_basic()
|
||||||
else {
|
else {
|
||||||
print "NA,-" # print an empty array, this will be further handled in the print out function
|
print "NA,-" # print an empty array, this will be further handled in the print out function
|
||||||
}
|
}
|
||||||
}' $DIR_PARTITIONS ) )
|
}' $FILE_PARTITIONS ) )
|
||||||
log_function_data 'cat' "$DIR_PARTITIONS"
|
log_function_data 'cat' "$FILE_PARTITIONS"
|
||||||
fi
|
fi
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
log_function_data "A_HDD_DATA: ${A_HDD_DATA[@]}"
|
log_function_data "A_HDD_DATA: ${A_HDD_DATA[@]}"
|
||||||
|
@ -2536,8 +2532,8 @@ get_hard_drive_data_advanced()
|
||||||
print c
|
print c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}' $DIR_SCSI ) )
|
}' $FILE_SCSI ) )
|
||||||
log_function_data 'cat' "$DIR_SCSI"
|
log_function_data 'cat' "$FILE_SCSI"
|
||||||
fi
|
fi
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
|
||||||
|
@ -2620,8 +2616,8 @@ get_memory_data()
|
||||||
END {
|
END {
|
||||||
used = tot-notused
|
used = tot-notused
|
||||||
printf("%.1f/%.1fMB\n", used/1024, tot/1024)
|
printf("%.1f/%.1fMB\n", used/1024, tot/1024)
|
||||||
}' $DIR_MEMINFO )
|
}' $FILE_MEMINFO )
|
||||||
log_function_data 'cat' "$DIR_MEMINFO"
|
log_function_data 'cat' "$FILE_MEMINFO"
|
||||||
fi
|
fi
|
||||||
echo "$memory"
|
echo "$memory"
|
||||||
log_function_data "memory: $memory"
|
log_function_data "memory: $memory"
|
||||||
|
@ -2751,7 +2747,7 @@ get_networking_local_ip_data()
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
if [[ $B_IFCONFIG == 'true' ]];then
|
if [[ $B_IFCONFIG == 'true' ]];then
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
A_INTERFACES_DATA=( $( $DIR_IFCONFIG | gawk '
|
A_INTERFACES_DATA=( $( ifconfig | gawk '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
IGNORECASE=1
|
IGNORECASE=1
|
||||||
}
|
}
|
||||||
|
@ -2946,7 +2942,7 @@ get_partition_data_advanced()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print partition "," label "," uuid
|
print partition "," label "," uuid
|
||||||
}' $DIR_MOUNTS )
|
}' $FILE_MOUNTS )
|
||||||
|
|
||||||
# echo dev_partition_data: $dev_partition_data
|
# echo dev_partition_data: $dev_partition_data
|
||||||
# assemble everything we could get for dev/h/dx, label, and uuid
|
# assemble everything we could get for dev/h/dx, label, and uuid
|
||||||
|
@ -3001,7 +2997,7 @@ get_partition_data_advanced()
|
||||||
A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","$dev_item","$dev_label","$dev_uuid
|
A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","$dev_item","$dev_label","$dev_uuid
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
done
|
done
|
||||||
log_function_data 'cat' "$DIR_MOUNTS"
|
log_function_data 'cat' "$FILE_MOUNTS"
|
||||||
fi
|
fi
|
||||||
log_function_data "A_PARTITION_DATA: ${A_PARTITION_DATA[@]}"
|
log_function_data "A_PARTITION_DATA: ${A_PARTITION_DATA[@]}"
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
|
@ -3467,7 +3463,7 @@ print_audio_data()
|
||||||
# if [[ -n ${a_audio_working[2]} ]];then
|
# if [[ -n ${a_audio_working[2]} ]];then
|
||||||
# port_data=" ${C1}at port${C2} ${a_audio_working[2]}"
|
# port_data=" ${C1}at port${C2} ${a_audio_working[2]}"
|
||||||
# fi
|
# fi
|
||||||
# this should only trigger if the $DIR_ASOUND_DEVICE data is used, not lspci -nn
|
# this should only trigger if the $FILE_ASOUND_DEVICE data is used, not lspci -nn
|
||||||
if [[ -n ${a_audio_working[3]} && $B_EXTRA_DATA == 'true' ]];then
|
if [[ -n ${a_audio_working[3]} && $B_EXTRA_DATA == 'true' ]];then
|
||||||
module_version=$( print_module_version "${a_audio_working[3]}" )
|
module_version=$( print_module_version "${a_audio_working[3]}" )
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue