mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
Patch version upgrade
fixed a bug with remote mounted partitions, created line length counter function that cleans off color code characters to allow for accurate line counts for line breaks.
This commit is contained in:
parent
c8c5ff2eea
commit
7d3a70ec6b
75
inxi
75
inxi
|
@ -3,7 +3,7 @@
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.7.2
|
#### version: 1.7.2
|
||||||
#### Date: June 17 2011
|
#### Date: June 17 2011
|
||||||
#### Patch Number: 01
|
#### Patch Number: 02
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -3417,7 +3417,8 @@ get_distro_lsb_data()
|
||||||
|
|
||||||
get_gcc_version()
|
get_gcc_version()
|
||||||
{
|
{
|
||||||
local gccVersion=$( grep -Eio 'gcc[[:space:]]*version[[:space:]]*([0-9\.]+)' /proc/version 2>/dev/null | grep -Eo '([0-9\.]+)' )
|
# note that we use gawk to get the last part because beta, alpha, git versions can be non-numeric
|
||||||
|
local gccVersion=$( grep -Eio 'gcc[[:space:]]*version[[:space:]]*([^ \t]*)' /proc/version 2>/dev/null | gawk '{print $3}' )
|
||||||
echo $gccVersion
|
echo $gccVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4894,33 +4895,38 @@ get_partition_data_advanced()
|
||||||
# it's more likely we'll get a uuid than a label. But this should get the
|
# it's more likely we'll get a uuid than a label. But this should get the
|
||||||
# dev item set no matter what, so then we can get the rest of any missing data
|
# dev item set no matter what, so then we can get the rest of any missing data
|
||||||
# first we'll get the dev_item if it's missing
|
# first we'll get the dev_item if it's missing
|
||||||
if [[ -n $DEV_DISK_UUID ]] && [[ -z $dev_item && -n $dev_uuid ]];then
|
if [[ -z $dev_item ]];then
|
||||||
dev_item=$( echo "$DEV_DISK_UUID" | gawk '
|
if [[ -n $DEV_DISK_UUID && -n $dev_uuid ]];then
|
||||||
/'$dev_uuid'/ {
|
dev_item=$( echo "$DEV_DISK_UUID" | gawk '
|
||||||
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
/'$dev_uuid'/ {
|
||||||
print item
|
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
||||||
}' )
|
print item
|
||||||
elif [[ -n $DEV_DISK_LABEL ]] && [[ -z $dev_item && -n $dev_label ]];then
|
}' )
|
||||||
dev_item=$( echo "$DEV_DISK_LABEL" | gawk '
|
elif [[ -n $DEV_DISK_LABEL && -n $dev_label ]];then
|
||||||
# first we need to change space x20 in by-label back to a real space
|
dev_item=$( echo "$DEV_DISK_LABEL" | gawk '
|
||||||
#gsub( /x20/, " ", $0 )
|
# first we need to change space x20 in by-label back to a real space
|
||||||
# then we can see if the string is there
|
#gsub( /x20/, " ", $0 )
|
||||||
/'$dev_label'/ {
|
# then we can see if the string is there
|
||||||
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
/'$dev_label'/ {
|
||||||
print item
|
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
||||||
}' )
|
print item
|
||||||
|
}' )
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ -n $DEV_DISK_UUID ]] && [[ -n $dev_item && -z $dev_uuid ]];then
|
# this can trigger all kinds of weird errors if it is a non /dev path, like: remote:/machine/name
|
||||||
dev_uuid=$( echo "$DEV_DISK_UUID" | gawk '
|
if [[ -n $dev_item && -z $( grep -E '(^//|:/)' <<< $dev_item ) ]];then
|
||||||
/'$dev_item'$/ {
|
if [[ -n $DEV_DISK_UUID && -z $dev_uuid ]];then
|
||||||
print $(NF - 2)
|
dev_uuid=$( echo "$DEV_DISK_UUID" | gawk '
|
||||||
}' )
|
/'$dev_item'$/ {
|
||||||
fi
|
print $(NF - 2)
|
||||||
if [[ -n $DEV_DISK_LABEL ]] && [[ -n $dev_item && -z $dev_label ]];then
|
}' )
|
||||||
dev_label=$( echo "$DEV_DISK_LABEL" | gawk '
|
fi
|
||||||
/'$dev_item'$/ {
|
if [[ -n $DEV_DISK_LABEL && -z $dev_label ]];then
|
||||||
print $(NF - 2)
|
dev_label=$( echo "$DEV_DISK_LABEL" | gawk '
|
||||||
}' )
|
/'$dev_item'$/ {
|
||||||
|
print $(NF - 2)
|
||||||
|
}' )
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# assemble everything we could get for dev/h/dx, label, and uuid
|
# assemble everything we could get for dev/h/dx, label, and uuid
|
||||||
|
@ -4935,7 +4941,6 @@ get_partition_data_advanced()
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# args: $1 - uuid/label
|
# args: $1 - uuid/label
|
||||||
get_partition_uuid_label_data()
|
get_partition_uuid_label_data()
|
||||||
{
|
{
|
||||||
|
@ -5674,6 +5679,17 @@ get_uptime()
|
||||||
#### special data handling for specific options and conditions
|
#### special data handling for specific options and conditions
|
||||||
#### -------------------------------------------------------------------
|
#### -------------------------------------------------------------------
|
||||||
|
|
||||||
|
# args: $1 - string to strip color code characters out of
|
||||||
|
# returns count of string length minus colors
|
||||||
|
calculate_line_length()
|
||||||
|
{
|
||||||
|
local string="$1"
|
||||||
|
# ansi: [1;34m irc: \x0312
|
||||||
|
string=$( sed -e "s/\x1b\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g" -e "s/\\\x0[0-9]\{1,3\}//g" <<< $string )
|
||||||
|
count=$( wc -c <<< $string )
|
||||||
|
echo $count
|
||||||
|
}
|
||||||
|
|
||||||
## multiply the core count by the data to be calculated, bmips, cache
|
## multiply the core count by the data to be calculated, bmips, cache
|
||||||
# args: $1 - string to handle; $2 - cpu count
|
# args: $1 - string to handle; $2 - cpu count
|
||||||
calculate_multicore_data()
|
calculate_multicore_data()
|
||||||
|
@ -6257,6 +6273,7 @@ print_gfx_data()
|
||||||
else
|
else
|
||||||
gfx_data="${C1}Card:${C2} Failed to Detect Video Card! "
|
gfx_data="${C1}Card:${C2} Failed to Detect Video Card! "
|
||||||
fi
|
fi
|
||||||
|
# calculate_line_length "${gfx_data}$display_full_string"
|
||||||
if [[ -n $gfx_data && $( wc -c <<< ${gfx_data}$display_full_string ) -lt $line_max ]];then
|
if [[ -n $gfx_data && $( wc -c <<< ${gfx_data}$display_full_string ) -lt $line_max ]];then
|
||||||
gfx_data=$( create_print_line "$line_starter" "${gfx_data}$display_full_string" )
|
gfx_data=$( create_print_line "$line_starter" "${gfx_data}$display_full_string" )
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue