mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
full dev, label, and uuid handling now, except for some fringe cases with arch
This is branches/one test, will require some fine tuning to make it work cleanly
This commit is contained in:
parent
815fd5533a
commit
6f94b59e1f
208
inxi
208
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.9.8-b1-t7
|
#### version: 0.9.10-b1-t1
|
||||||
#### Date: 3 February 2009
|
#### Date: 4 February 2009
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -159,6 +159,7 @@ B_SHOW_GRAPHICS='false'
|
||||||
B_SHOW_HOST='true'
|
B_SHOW_HOST='true'
|
||||||
B_SHOW_INFO='false'
|
B_SHOW_INFO='false'
|
||||||
B_SHOW_IP='false'
|
B_SHOW_IP='false'
|
||||||
|
B_SHOW_LABELS='false'
|
||||||
B_SHOW_NETWORK='false'
|
B_SHOW_NETWORK='false'
|
||||||
# either -v > 3 or -P will show partitions
|
# either -v > 3 or -P will show partitions
|
||||||
B_SHOW_PARTITIONS='false'
|
B_SHOW_PARTITIONS='false'
|
||||||
|
@ -166,6 +167,7 @@ B_SHOW_PARTITIONS_FULL='false'
|
||||||
# triggers only short inxi output
|
# triggers only short inxi output
|
||||||
B_SHOW_SHORT_OUTPUT='false'
|
B_SHOW_SHORT_OUTPUT='false'
|
||||||
B_SHOW_SYSTEM='false'
|
B_SHOW_SYSTEM='false'
|
||||||
|
B_SHOW_UUIDS='false'
|
||||||
# triggers various debugging and new option testing
|
# triggers various debugging and new option testing
|
||||||
B_TESTING_1='false'
|
B_TESTING_1='false'
|
||||||
B_TESTING_2='false'
|
B_TESTING_2='false'
|
||||||
|
@ -183,17 +185,18 @@ B_IFCONFIG='false'
|
||||||
B_LSB_DIR='false'
|
B_LSB_DIR='false'
|
||||||
B_SCSI_DIR='false'
|
B_SCSI_DIR='false'
|
||||||
B_MODULES_DIR='false' #
|
B_MODULES_DIR='false' #
|
||||||
|
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'
|
DIR_CPUINFO='/proc/cpuinfo'
|
||||||
# DIR_CPUINFO="$HOME/bin/scripts/inxi/svn/modules/data/xeon_2x_2"
|
|
||||||
DIR_MEMINFO='/proc/meminfo'
|
DIR_MEMINFO='/proc/meminfo'
|
||||||
DIR_ASOUND_DEVICE='/proc/asound/cards'
|
DIR_ASOUND_DEVICE='/proc/asound/cards'
|
||||||
DIR_ASOUND_VERSION='/proc/asound/version'
|
DIR_ASOUND_VERSION='/proc/asound/version'
|
||||||
DIR_LSB_RELEASE='/etc/lsb-release'
|
DIR_LSB_RELEASE='/etc/lsb-release'
|
||||||
DIR_SCSI='/proc/scsi/scsi'
|
DIR_SCSI='/proc/scsi/scsi'
|
||||||
DIR_MODULES='/proc/modules' #
|
DIR_MODULES='/proc/modules' #
|
||||||
|
DIR_MOUNTS='/proc/mounts'
|
||||||
DIR_PARTITIONS='/proc/partitions' #
|
DIR_PARTITIONS='/proc/partitions' #
|
||||||
DIR_IFCONFIG='/sbin/ifconfig'
|
DIR_IFCONFIG='/sbin/ifconfig'
|
||||||
|
|
||||||
|
@ -460,6 +463,10 @@ initialize_script_data()
|
||||||
B_MODULES_DIR='true'
|
B_MODULES_DIR='true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -e "$DIR_MOUNTS" ]];then
|
||||||
|
B_MOUNTS_DIR='true'
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -e "$DIR_PARTITIONS" ]];then
|
if [[ -e "$DIR_PARTITIONS" ]];then
|
||||||
B_PARTITIONS_DIR='true'
|
B_PARTITIONS_DIR='true'
|
||||||
fi
|
fi
|
||||||
|
@ -785,7 +792,7 @@ get_parameters()
|
||||||
# the short form only runs if no args output args are used
|
# the short form only runs if no args output args are used
|
||||||
# no need to run through these if there are no args
|
# no need to run through these if there are no args
|
||||||
if [[ -n $1 ]];then
|
if [[ -n $1 ]];then
|
||||||
while getopts Ac:CdDfFGhHiINpPSv:Vx%@:${update_flags} opt
|
while getopts Ac:CdDfFGhHiIlNpPSuv:Vx%@:${update_flags} opt
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
A) B_SHOW_AUDIO='true'
|
A) B_SHOW_AUDIO='true'
|
||||||
|
@ -832,6 +839,9 @@ get_parameters()
|
||||||
I) B_SHOW_INFO='true'
|
I) B_SHOW_INFO='true'
|
||||||
use_short='false'
|
use_short='false'
|
||||||
;;
|
;;
|
||||||
|
l) B_SHOW_LABELS='true'
|
||||||
|
use_short='false'
|
||||||
|
;;
|
||||||
N) B_SHOW_NETWORK='true'
|
N) B_SHOW_NETWORK='true'
|
||||||
use_short='false'
|
use_short='false'
|
||||||
;;
|
;;
|
||||||
|
@ -845,6 +855,9 @@ get_parameters()
|
||||||
S) B_SHOW_SYSTEM='true'
|
S) B_SHOW_SYSTEM='true'
|
||||||
use_short='false'
|
use_short='false'
|
||||||
;;
|
;;
|
||||||
|
u) B_SHOW_UUIDS='true'
|
||||||
|
use_short='false'
|
||||||
|
;;
|
||||||
v) if [[ -n $( egrep "^[0-9][0-9]?$" <<< $OPTARG ) && $OPTARG -le $VERBOSITY_LEVELS ]];then
|
v) if [[ -n $( egrep "^[0-9][0-9]?$" <<< $OPTARG ) && $OPTARG -le $VERBOSITY_LEVELS ]];then
|
||||||
VERBOSITY_LEVEL="$OPTARG"
|
VERBOSITY_LEVEL="$OPTARG"
|
||||||
if [[ $OPTARG -gt 0 ]];then
|
if [[ $OPTARG -gt 0 ]];then
|
||||||
|
@ -944,12 +957,14 @@ show_options()
|
||||||
print_screen_output "-i Show Wan IP address, and shows local interfaces (requires ifconfig network tool)."
|
print_screen_output "-i Show Wan IP address, and shows local interfaces (requires ifconfig network tool)."
|
||||||
print_screen_output " Not shown with -F for user security reasons, you shouldn't paste your local/wan IP."
|
print_screen_output " Not shown with -F for user security reasons, you shouldn't paste your local/wan IP."
|
||||||
print_screen_output "-I Show information: processes, uptime, memory, irc client, inxi version."
|
print_screen_output "-I Show information: processes, uptime, memory, irc client, inxi version."
|
||||||
|
print_screen_output "-l Show partition labels (use with -p or -P)."
|
||||||
print_screen_output "-N Show network card information."
|
print_screen_output "-N Show network card information."
|
||||||
print_screen_output "-p Show full partition information (-P plus all other detected partitions)."
|
print_screen_output "-p Show full partition information (-P plus all other detected partitions)."
|
||||||
print_screen_output " If any of your partitions have spaces in their names, they will not show with -p"
|
print_screen_output " If any of your partitions have spaces in their names, they will not show with -p"
|
||||||
print_screen_output "-P Show partition information (shows what -v4 would show, but without extra data)."
|
print_screen_output "-P Show partition information (shows what -v4 would show, but without extra data)."
|
||||||
print_screen_output " Shows, if detected: / /boot /home /tmp /usr /var. Use -p for All partitions."
|
print_screen_output " Shows, if detected: / /boot /home /tmp /usr /var. Use -p for All partitions."
|
||||||
print_screen_output "-S Show system information: host name, kernel, distro"
|
print_screen_output "-S Show system information: host name, kernel, distro"
|
||||||
|
print_screen_output "-u Show partition UUIDs (use with -p or -P)."
|
||||||
print_screen_output "-v Script verbosity levels. Verbosity level number is required."
|
print_screen_output "-v Script verbosity levels. Verbosity level number is required."
|
||||||
print_screen_output " Supported levels: 0-${VERBOSITY_LEVELS} Example: $SCRIPT_NAME -v 4"
|
print_screen_output " Supported levels: 0-${VERBOSITY_LEVELS} Example: $SCRIPT_NAME -v 4"
|
||||||
print_screen_output " 0 - short output, same as: $SCRIPT_NAME"
|
print_screen_output " 0 - short output, same as: $SCRIPT_NAME"
|
||||||
|
@ -1520,18 +1535,19 @@ get_cpu_ht_multicore_smp_data()
|
||||||
FS=": "
|
FS=": "
|
||||||
IGNORECASE = 1
|
IGNORECASE = 1
|
||||||
core_count = 0
|
core_count = 0
|
||||||
cores = 1 # single cores are obviously a Uni-processor
|
|
||||||
i = 0
|
i = 0
|
||||||
index_temp = ""
|
index_temp = ""
|
||||||
|
num_of_cores = 0
|
||||||
physical_cpu_count = 0
|
physical_cpu_count = 0
|
||||||
|
processor_logical_count = 0
|
||||||
processors = 1
|
processors = 1
|
||||||
type = "UP"
|
type = "UP"
|
||||||
}
|
}
|
||||||
# counts logical processors, both HT and physical
|
# counts logical processors, both HT and physical
|
||||||
/^processor/ {
|
/^processor/ {
|
||||||
num_of_processors = $NF + 1
|
processor_logical_count = $NF + 1
|
||||||
}
|
}
|
||||||
# counts physical cores
|
# counts physical cores (not used currently)
|
||||||
/^cpu cores/ {
|
/^cpu cores/ {
|
||||||
num_of_cores = $NF
|
num_of_cores = $NF
|
||||||
}
|
}
|
||||||
|
@ -1546,11 +1562,12 @@ get_cpu_ht_multicore_smp_data()
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
# look for the largest id number, and assign it
|
# look for the largest id number, and assign it
|
||||||
for ( j = 0; j < num_of_processors; j++ ) {
|
for ( j = 0; j < processor_logical_count; j++ ) {
|
||||||
if ( a_core_id[j] > core_count ) {
|
if ( a_core_id[j] > core_count ) {
|
||||||
core_count = a_core_id[j]
|
core_count = a_core_id[j]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
core_count = core_count + 1
|
||||||
# trick, set the index equal to value, if the same, it will overwrite
|
# trick, set the index equal to value, if the same, it will overwrite
|
||||||
# this lets us create the actual array of true cpu physical ids
|
# this lets us create the actual array of true cpu physical ids
|
||||||
for ( j in a_physical_id ) {
|
for ( j in a_physical_id ) {
|
||||||
|
@ -1561,15 +1578,14 @@ get_cpu_ht_multicore_smp_data()
|
||||||
for ( j in a_cpu_physical_working ) {
|
for ( j in a_cpu_physical_working ) {
|
||||||
++physical_cpu_count
|
++physical_cpu_count
|
||||||
}
|
}
|
||||||
core_count = core_count + 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
|
||||||
# http://en.wikipedia.org/wiki/Symmetric_multiprocessing
|
# http://en.wikipedia.org/wiki/Symmetric_multiprocessing
|
||||||
if ( num_of_processors > 1 ) {
|
if ( processor_logical_count > 1 ) {
|
||||||
per_cpu_core_count = num_of_processors / physical_cpu_count
|
if ( processor_logical_count > core_count && physical_cpu_count > 1 ) {
|
||||||
if ( physical_cpu_count == per_cpu_core_count && physical_cpu_count > 1 ) {
|
type = "SMP-HT" # could be Xeon/P4 HT dual cpu
|
||||||
type = "SMP-HT"
|
|
||||||
}
|
}
|
||||||
else if ( physical_cpu_count == per_cpu_core_count ) {
|
else if ( processor_logical_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 {
|
||||||
|
@ -2314,8 +2330,9 @@ get_partition_data()
|
||||||
# the test show the wrong data in each of the fields, if no x%, then do not use
|
# the test show the wrong data in each of the fields, if no x%, then do not use
|
||||||
if ( $(NF - 1) ~ /[0-9]+\%/ ) {
|
if ( $(NF - 1) ~ /[0-9]+\%/ ) {
|
||||||
# cleaning up user name here to avoid showing too much info on irc
|
# cleaning up user name here to avoid showing too much info on irc
|
||||||
partitionName=gensub( /^\/home\/(.*)\/(.*)/, "/home/###/\\2", 1, $NF )
|
# partitionName=gensub( /^\/home\/(.*)\/(.*)/, "/home/###/\\2", 1, $NF )
|
||||||
print partitionName "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary"
|
# print partitionName "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary"
|
||||||
|
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
' )
|
' )
|
||||||
|
@ -2324,9 +2341,117 @@ get_partition_data()
|
||||||
$( swapon -s | gawk '
|
$( swapon -s | gawk '
|
||||||
/^\/dev\/[hs]d[a-z]/ {
|
/^\/dev\/[hs]d[a-z]/ {
|
||||||
size = sprintf( "%.2f", $3*1024/1000**3 )
|
size = sprintf( "%.2f", $3*1024/1000**3 )
|
||||||
print $1 "," size "GB,,,swap"
|
devBase = gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 )
|
||||||
|
print $1 "," size "GB,,,swap," devBase
|
||||||
}' ) )
|
}' ) )
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
|
||||||
|
if [[ "$B_SHOW_LABELS" == 'true' || "$B_SHOW_UUIDS" == 'true' ]];then
|
||||||
|
get_partition_data_advanced
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# first get the locations of the mount points for label/uuid detection
|
||||||
|
get_partition_data_advanced()
|
||||||
|
{
|
||||||
|
local a_partition_working='' dev_partition_data=''
|
||||||
|
local dev_disk_label='' dev_disk_uuid='' dev_item='' dev_label='' dev_uuid=''
|
||||||
|
|
||||||
|
if [[ -d /dev/disk/by-label ]];then
|
||||||
|
dev_disk_label="$( ls -l /dev/disk/by-label )"
|
||||||
|
fi
|
||||||
|
if [[ -d /dev/disk/by-uuid ]];then
|
||||||
|
dev_disk_uuid="$( ls -l /dev/disk/by-uuid )"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$B_MOUNTS_DIR" == 'true' ]];then
|
||||||
|
for (( i=0; i < ${#A_PARTITION_DATA[@]}; i++ ))
|
||||||
|
do
|
||||||
|
IFS=","
|
||||||
|
a_partition_working=( ${A_PARTITION_DATA[i]} )
|
||||||
|
IFS="$ORIGINAL_IFS"
|
||||||
|
# note: for swap this will already be set
|
||||||
|
if [[ -z "${a_partition_working[5]}" ]];then
|
||||||
|
mount_point=$( sed 's|/|\\/|g' <<< ${a_partition_working[0]} )
|
||||||
|
#echo mount_point $mount_point
|
||||||
|
dev_partition_data=$( gawk '
|
||||||
|
BEGIN {
|
||||||
|
label = ""
|
||||||
|
uuid = ""
|
||||||
|
}
|
||||||
|
/[ \t]'$mount_point'[ \t]/ && $1 != "rootfs" {
|
||||||
|
partition=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 )
|
||||||
|
# label and uuid can occur for root
|
||||||
|
if ( partition ~ /by-label/ ) {
|
||||||
|
label=gensub( /^(\/dev\/disk\/by-label\/)(.+)$/, "\\2", 1, $1 )
|
||||||
|
}
|
||||||
|
if ( partition ~ /by-uuid/ ) {
|
||||||
|
uuid=gensub( /^(\/dev\/disk\/by-uuid\/)(.+)$/, "\\2", 1, $1 )
|
||||||
|
}
|
||||||
|
# if partition is not standard /dev/h/dx, but rather /dev/disk/... set it null since
|
||||||
|
# that is not useful for this purpose.
|
||||||
|
if ( partition ~ /disk/ ) {
|
||||||
|
partition = ""
|
||||||
|
}
|
||||||
|
#print $1 "," label "," uuid
|
||||||
|
print partition "," label "," uuid
|
||||||
|
}' $DIR_MOUNTS )
|
||||||
|
|
||||||
|
# echo dev_partition_data: $dev_partition_data
|
||||||
|
# assemble everything we could get for dev/h/dx, label, and uuid
|
||||||
|
IFS=","
|
||||||
|
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_partition_data
|
||||||
|
IFS="$ORIGINAL_IFS"
|
||||||
|
fi
|
||||||
|
## now we're ready to proceed filling in the data
|
||||||
|
IFS=","
|
||||||
|
a_partition_working=( ${A_PARTITION_DATA[i]} )
|
||||||
|
IFS="$ORIGINAL_IFS"
|
||||||
|
|
||||||
|
dev_item=${a_partition_working[5]}
|
||||||
|
dev_label=${a_partition_working[6]}
|
||||||
|
dev_uuid=${a_partition_working[7]}
|
||||||
|
|
||||||
|
if [[ -n "$dev_disk_label" ]];then
|
||||||
|
if [[ -n "$dev_item" && -z "$dev_label" ]];then
|
||||||
|
dev_label=$( echo "$dev_disk_label" | gawk '
|
||||||
|
/'$dev_item'$/ {
|
||||||
|
print $(NF - 2)
|
||||||
|
}' )
|
||||||
|
elif [[ -z "$dev_item" && -n "$dev_label" ]];then
|
||||||
|
dev_item=$( echo "$dev_disk_label" | gawk '
|
||||||
|
/'$dev_label'/ {
|
||||||
|
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
||||||
|
print item
|
||||||
|
}' )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ -n "$dev_disk_uuid" ]];then
|
||||||
|
if [[ -n "$dev_item" && -z "$dev_uuid" ]];then
|
||||||
|
dev_uuid=$( echo "$dev_disk_uuid" | gawk '
|
||||||
|
/'$dev_item'$/ {
|
||||||
|
print $(NF - 2)
|
||||||
|
}' )
|
||||||
|
elif [[ -z "$dev_item" && -n "$dev_uuid" ]];then
|
||||||
|
dev_item=$( echo "$dev_disk_uuid" | gawk '
|
||||||
|
/'$dev_label'/ {
|
||||||
|
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
||||||
|
print item
|
||||||
|
}' )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# assemble everything we could get for dev/h/dx, label, and uuid
|
||||||
|
IFS=","
|
||||||
|
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"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# echo 'A_PARTITION_DATA: ' "${A_PARTITION_DATA[@]}"
|
||||||
|
}
|
||||||
|
# $1 - mount point
|
||||||
|
get_partition_full_data()
|
||||||
|
{
|
||||||
|
:
|
||||||
}
|
}
|
||||||
|
|
||||||
## return uptime string
|
## return uptime string
|
||||||
|
@ -2482,14 +2607,14 @@ print_short_data()
|
||||||
local cpu_core_count=${A_CPU_CORE_DATA[3]}
|
local cpu_core_count=${A_CPU_CORE_DATA[3]}
|
||||||
local cpu_core_alpha=${A_CPU_CORE_DATA[1]}
|
local cpu_core_alpha=${A_CPU_CORE_DATA[1]}
|
||||||
local cpu_type=${A_CPU_CORE_DATA[2]}
|
local cpu_type=${A_CPU_CORE_DATA[2]}
|
||||||
local cores_per_cpu=$(( $cpu_core_count / $cpu_physical_count ))
|
|
||||||
if [[ "$cpu_physical_count" -gt 1 ]];then
|
if [[ "$cpu_physical_count" -gt 1 ]];then
|
||||||
cpc_plural='(s)'
|
cpc_plural='(s)'
|
||||||
model_plural='s'
|
model_plural='s'
|
||||||
cpu_count_print="$cpu_physical_count "
|
cpu_count_print="$cpu_physical_count "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local cpu_data_string="${cpu_count_print}${cpu_core_alpha} core ${cpu_type}"
|
local cpu_data_string="${cpu_count_print}${cpu_core_alpha} core"
|
||||||
# local cpu_core_count=${A_CPU_CORE_DATA[0]}
|
# local cpu_core_count=${A_CPU_CORE_DATA[0]}
|
||||||
|
|
||||||
# load A_HDD_DATA
|
# load A_HDD_DATA
|
||||||
|
@ -2539,7 +2664,7 @@ print_short_data()
|
||||||
#C1="${C1},1"; C2="${C2},1"; CN="${CN},1"
|
#C1="${C1},1"; C2="${C2},1"; CN="${CN},1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
short_data="${C1}CPU$cpc_plural${CN}[${C2} ${cpu_data_string} ${cpu_model}$model_plural ${C1}clocked at${C2} ${min_max_clock}${CN}] ${C1}Kernel${CN}[${C2} ${current_kernel}${CN}] ${C1}Up${CN}[${C2}${FL2}${FL1}${up_time}${FL1}${CN}] ${C1}Mem${CN}[${C2}${FL2}${FL1}${memory}${FL1}${CN}] ${C1}HDD${CN}[${C2}${FL2}${FL1}${hdd_capacity}($hdd_used)${FL1}${CN}] ${C1}Procs${CN}[${C2}${FL2}${FL1}${processes}${FL1}${CN}]"
|
short_data="${C1}CPU$cpc_plural${CN}[${C2} ${cpu_data_string} ${cpu_model}$model_plural (${cpu_type}) ${C1}clocked at${C2} ${min_max_clock}${CN}] ${C1}Kernel${CN}[${C2} ${current_kernel}${CN}] ${C1}Up${CN}[${C2}${FL2}${FL1}${up_time}${FL1}${CN}] ${C1}Mem${CN}[${C2}${FL2}${FL1}${memory}${FL1}${CN}] ${C1}HDD${CN}[${C2}${FL2}${FL1}${hdd_capacity}($hdd_used)${FL1}${CN}] ${C1}Procs${CN}[${C2}${FL2}${FL1}${processes}${FL1}${CN}]"
|
||||||
|
|
||||||
if [[ $SHOW_IRC -gt 0 ]];then
|
if [[ $SHOW_IRC -gt 0 ]];then
|
||||||
short_data="${short_data} ${C1}Client${CN}[${C2}${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}]"
|
short_data="${short_data} ${C1}Client${CN}[${C2}${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}]"
|
||||||
|
@ -2664,7 +2789,7 @@ print_cpu_data()
|
||||||
model_plural='s'
|
model_plural='s'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local cpu_data_string="${cpu_count_print}${cpu_core_alpha} core ${cpu_type}"
|
local cpu_data_string="${cpu_count_print}${cpu_core_alpha} core"
|
||||||
# Strange (and also some expected) behavior encountered. If print_screen_output() uses $1
|
# Strange (and also some expected) behavior encountered. If print_screen_output() uses $1
|
||||||
# as the parameter to output to the screen, then passing "<text1> ${ARR[@]} <text2>"
|
# as the parameter to output to the screen, then passing "<text1> ${ARR[@]} <text2>"
|
||||||
# will output only <text1> and first element of ARR. That "@" splits in elements and "*" _doesn't_,
|
# will output only <text1> and first element of ARR. That "@" splits in elements and "*" _doesn't_,
|
||||||
|
@ -2677,12 +2802,12 @@ print_cpu_data()
|
||||||
a_cpu_working[2]="unknown"
|
a_cpu_working[2]="unknown"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cpu_data=$( create_print_line "CPU$cpc_plural:" "${C1}${cpu_data_string}${C2} ${a_cpu_working[0]}$model_plural" )
|
cpu_data=$( create_print_line "CPU$cpc_plural:" "${C1}${cpu_data_string}${C2} ${a_cpu_working[0]}$model_plural (${cpu_type})" )
|
||||||
if [[ $VERBOSITY_LEVEL -ge 3 || $B_SHOW_CPU == 'true' ]];then
|
if [[ $VERBOSITY_LEVEL -ge 3 || $B_SHOW_CPU == 'true' ]];then
|
||||||
# update for multicore, bogomips x core count.
|
# update for multicore, bogomips x core count.
|
||||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||||
# if [[ $cpu_vendor != 'intel' ]];then
|
# if [[ $cpu_vendor != 'intel' ]];then
|
||||||
bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$cpu_core_count" )
|
bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$(( $cpu_core_count * $cpu_physical_count ))" )
|
||||||
# else
|
# else
|
||||||
# bmip_data="${a_cpu_working[4]}"
|
# bmip_data="${a_cpu_working[4]}"
|
||||||
# fi
|
# fi
|
||||||
|
@ -3031,6 +3156,7 @@ print_partition_data()
|
||||||
{
|
{
|
||||||
local a_partition_working='' partition_used='' swap='' partition_data=''
|
local a_partition_working='' partition_used='' swap='' partition_data=''
|
||||||
local counter=0 line_max=160 i=0 a_partition_data='' line_starter=''
|
local counter=0 line_max=160 i=0 a_partition_data='' line_starter=''
|
||||||
|
local partitionIdClean='' part_dev='' full_dev='' part_label='' full_label='' part_uuid='' full_uuid=''
|
||||||
|
|
||||||
# this handles the different, shorter, irc colors strings embedded in variable data
|
# this handles the different, shorter, irc colors strings embedded in variable data
|
||||||
if [[ $B_RUNNING_IN_SHELL != 'true' ]];then
|
if [[ $B_RUNNING_IN_SHELL != 'true' ]];then
|
||||||
|
@ -3040,6 +3166,9 @@ print_partition_data()
|
||||||
if [[ $SCHEME -eq 0 ]];then
|
if [[ $SCHEME -eq 0 ]];then
|
||||||
line_max=75
|
line_max=75
|
||||||
fi
|
fi
|
||||||
|
if [[ "$B_SHOW_LABELS" == 'true' || "$B_SHOW_UUIDS" == 'true' ]];then
|
||||||
|
line_max=20
|
||||||
|
fi
|
||||||
|
|
||||||
# set A_PARTITION_DATA
|
# set A_PARTITION_DATA
|
||||||
get_partition_data
|
get_partition_data
|
||||||
|
@ -3051,18 +3180,45 @@ print_partition_data()
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
|
||||||
if [[ $B_SHOW_PARTITIONS_FULL == 'true' ]] || [[ ${a_partition_working[4]} == 'swap' || ${a_partition_working[4]} == 'main' ]];then
|
if [[ $B_SHOW_PARTITIONS_FULL == 'true' ]] || [[ ${a_partition_working[4]} == 'swap' || ${a_partition_working[4]} == 'main' ]];then
|
||||||
if [[ -n ${a_partition_working[2]} ]];then
|
if [[ -n "${a_partition_working[2]}" ]];then
|
||||||
partition_used=" ${C1}used:${C2} ${a_partition_working[2]} (${a_partition_working[3]})"
|
partition_used=" ${C1}used:${C2} ${a_partition_working[2]} (${a_partition_working[3]})"
|
||||||
else
|
else
|
||||||
partition_used='' # reset partition used to null
|
partition_used='' # reset partition used to null
|
||||||
fi
|
fi
|
||||||
if [[ ${a_partition_working[4]} == 'swap' ]];then
|
if [[ "${a_partition_working[4]}" == 'swap' ]];then
|
||||||
swap=" ${C1}swap:${C2}"
|
swap=" ${C1}swap:${C2}"
|
||||||
else
|
else
|
||||||
swap=''
|
swap=''
|
||||||
fi
|
fi
|
||||||
|
# don't show user names in output
|
||||||
|
if [[ "$B_SHOW_LABELS" == 'true' || "$B_SHOW_UUIDS" == 'true' ]];then
|
||||||
|
if [[ -n "${a_partition_working[5]}" ]];then
|
||||||
|
part_dev="/dev/${a_partition_working[5]}"
|
||||||
|
else
|
||||||
|
part_dev='N/A'
|
||||||
|
fi
|
||||||
|
full_dev=" ${C1}dev:${C2} $part_dev"
|
||||||
|
if [[ "$B_SHOW_LABELS" == 'true' ]];then
|
||||||
|
if [[ -n "${a_partition_working[6]}" ]];then
|
||||||
|
part_label="${a_partition_working[6]}"
|
||||||
|
else
|
||||||
|
part_label='N/A'
|
||||||
|
fi
|
||||||
|
full_label=" ${C1}label:${C2} $part_label"
|
||||||
|
fi
|
||||||
|
if [[ "$B_SHOW_UUIDS" == 'true' ]];then
|
||||||
|
if [[ -n "${a_partition_working[7]}" ]];then
|
||||||
|
part_uuid="${a_partition_working[7]}"
|
||||||
|
else
|
||||||
|
part_uuid='N/A'
|
||||||
|
fi
|
||||||
|
full_uuid=" ${C1}uuid:${C2} $part_uuid"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
partitionIdClean=$( sed -r 's|/home/(.*)/(.*)|/home/##/\2|' <<< ${a_partition_working[0]} )
|
||||||
# because these lines can vary widely, using dynamic length handling here
|
# because these lines can vary widely, using dynamic length handling here
|
||||||
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$swap${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]}$partition_used "
|
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$swap$partitionIdClean ${C1}size:${C2} ${a_partition_working[1]}$partition_used$full_dev$full_label$full_uuid"
|
||||||
|
|
||||||
if [[ $( wc -c <<< ${a_partition_data[$counter]} ) -gt $line_max ]];then
|
if [[ $( wc -c <<< ${a_partition_data[$counter]} ) -gt $line_max ]];then
|
||||||
((counter++))
|
((counter++))
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue