mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
(change version)
added partition fs type output
This commit is contained in:
parent
3a91faffee
commit
3ae77ae353
57
inxi
57
inxi
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.1.13
|
||||
#### Date: August 6 2009
|
||||
#### version: 1.1.14
|
||||
#### Date: October 9 2009
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
########################################################################
|
||||
|
@ -2904,7 +2904,7 @@ get_partition_data()
|
|||
# this handles yet another fredforfaen special case where a mounted drive
|
||||
# has the search string in its name
|
||||
$NF ~ /^\/$|^\/boot$|^\/var$|^\/home$|^\/tmp$|^\/usr$/ {
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main," devBase
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main," $(NF - 5) "," devBase
|
||||
}
|
||||
# skip all these, including the first, header line. Use the --exclude-type
|
||||
# to handle new filesystems types we do not want listed here
|
||||
|
@ -2913,14 +2913,14 @@ get_partition_data()
|
|||
# the test show the wrong data in each of the fields, if no x%, then do not use
|
||||
# using 3 cases, first default, standard, 2nd, 3rd, handles one and two spaces in name
|
||||
if ( $(NF - 1) ~ /[0-9]+\%/ ) {
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary," devBase
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary," $(NF - 5) "," devBase
|
||||
}
|
||||
# these two cases construct the space containing name
|
||||
else if ( $(NF - 2) ~ /[0-9]+\%/ ) {
|
||||
print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary," devBase
|
||||
print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary," $(NF - 6) "," devBase
|
||||
}
|
||||
else if ( $(NF - 3) ~ /[0-9]+\%/ ) {
|
||||
print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary," devBase
|
||||
print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary," $(NF - 7) "," devBase
|
||||
}
|
||||
}
|
||||
' )
|
||||
|
@ -2936,7 +2936,7 @@ get_partition_data()
|
|||
devBase = gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 )
|
||||
used = sprintf( "%.2f", $4*1024/1000**3 )
|
||||
percentUsed = sprintf( "%.0f", ( $4/$3 )*100 )
|
||||
print "swap-" swapCounter "," size "GB," used "GB," percentUsed "\%,main," devBase
|
||||
print "swap-" swapCounter "," size "GB," used "GB," percentUsed "\%,main," "swap," devBase
|
||||
swapCounter = ++swapCounter
|
||||
}' ) )
|
||||
IFS="$ORIGINAL_IFS"
|
||||
|
@ -2970,8 +2970,9 @@ get_partition_data_advanced()
|
|||
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
|
||||
if [[ -z ${a_partition_working[6]} ]];then
|
||||
mount_point=$( sed 's|/|\\/|g' <<< ${a_partition_working[0]} )
|
||||
#echo mount_point $mount_point
|
||||
dev_partition_data=$( gawk '
|
||||
|
@ -3025,10 +3026,9 @@ get_partition_data_advanced()
|
|||
print partition "," label "," uuid
|
||||
}' $FILE_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
|
||||
A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","${a_partition_working[5]}","$dev_partition_data
|
||||
IFS="$ORIGINAL_IFS"
|
||||
fi
|
||||
## now we're ready to proceed filling in the data
|
||||
|
@ -3036,9 +3036,9 @@ get_partition_data_advanced()
|
|||
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]}
|
||||
dev_item=${a_partition_working[6]}
|
||||
dev_label=${a_partition_working[7]}
|
||||
dev_uuid=${a_partition_working[8]}
|
||||
|
||||
# then if dev data/uuid is incomplete, try to get missing piece
|
||||
# it's more likely we'll get a uuid than a label. But this should get the
|
||||
|
@ -3071,11 +3071,11 @@ get_partition_data_advanced()
|
|||
/'$dev_item'/ {
|
||||
print $(NF - 2)
|
||||
}' )
|
||||
|
||||
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
|
||||
A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","${a_partition_working[5]}","$dev_item","$dev_label","$dev_uuid
|
||||
IFS="$ORIGINAL_IFS"
|
||||
done
|
||||
log_function_data 'cat' "$FILE_MOUNTS"
|
||||
|
@ -4173,7 +4173,7 @@ print_partition_data()
|
|||
local a_partition_working='' partition_used='' partition_data=''
|
||||
local counter=0 line_max=160 i=0 a_partition_data='' line_starter=''
|
||||
local partitionIdClean='' part_dev='' full_dev='' part_label='' full_label=''
|
||||
local part_uuid='' full_uuid='' dev_remote=''
|
||||
local part_uuid='' full_uuid='' dev_remote='' full_fs=''
|
||||
|
||||
# this handles the different, shorter, irc colors strings embedded in variable data
|
||||
if [[ $B_RUNNING_IN_SHELL != 'true' ]];then
|
||||
|
@ -4197,21 +4197,28 @@ print_partition_data()
|
|||
IFS="$ORIGINAL_IFS"
|
||||
full_label=''
|
||||
full_uuid=''
|
||||
|
||||
if [[ $B_SHOW_PARTITIONS_FULL == 'true' ]] || [[ ${a_partition_working[4]} == 'main' ]];then
|
||||
if [[ -n ${a_partition_working[2]} ]];then
|
||||
partition_used=" ${C1}used:${C2} ${a_partition_working[2]} (${a_partition_working[3]})"
|
||||
else
|
||||
partition_used='' # reset partition used to null
|
||||
fi
|
||||
if [[ -n ${a_partition_working[5]} ]];then
|
||||
full_fs="${a_partition_working[5]}"
|
||||
else
|
||||
full_fs='N/A' # reset partition used to null
|
||||
fi
|
||||
full_fs=" ${C1}fs:${C2} $full_fs"
|
||||
|
||||
# don't show user names in output
|
||||
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then
|
||||
if [[ -n ${a_partition_working[5]} ]];then
|
||||
if [[ -z $( grep -E '(^//|:/)' <<< ${a_partition_working[5]} ) ]];then
|
||||
part_dev="/dev/${a_partition_working[5]}"
|
||||
if [[ -n ${a_partition_working[6]} ]];then
|
||||
if [[ -z $( grep -E '(^//|:/)' <<< ${a_partition_working[6]} ) ]];then
|
||||
part_dev="/dev/${a_partition_working[6]}"
|
||||
dev_remote='dev'
|
||||
else
|
||||
part_dev="${a_partition_working[5]}"
|
||||
part_dev="${a_partition_working[6]}"
|
||||
dev_remote='remote'
|
||||
fi
|
||||
else
|
||||
|
@ -4220,16 +4227,16 @@ print_partition_data()
|
|||
fi
|
||||
full_dev=" ${C1}$dev_remote:${C2} $part_dev"
|
||||
if [[ $B_SHOW_LABELS == 'true' && $dev_remote != 'remote' ]];then
|
||||
if [[ -n ${a_partition_working[6]} ]];then
|
||||
part_label="${a_partition_working[6]}"
|
||||
if [[ -n ${a_partition_working[7]} ]];then
|
||||
part_label="${a_partition_working[7]}"
|
||||
else
|
||||
part_label='N/A'
|
||||
fi
|
||||
full_label=" ${C1}label:${C2} $part_label"
|
||||
fi
|
||||
if [[ $B_SHOW_UUIDS == 'true' && $dev_remote != 'remote' ]];then
|
||||
if [[ -n ${a_partition_working[7]} ]];then
|
||||
part_uuid="${a_partition_working[7]}"
|
||||
if [[ -n ${a_partition_working[8]} ]];then
|
||||
part_uuid="${a_partition_working[8]}"
|
||||
else
|
||||
part_uuid='N/A'
|
||||
fi
|
||||
|
@ -4238,7 +4245,7 @@ print_partition_data()
|
|||
fi
|
||||
partitionIdClean=$( sed -r 's|/home/(.*)/(.*)|/home/##/\2|' <<< ${a_partition_working[0]} )
|
||||
# because these lines can vary widely, using dynamic length handling here
|
||||
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$partitionIdClean ${C1}size:${C2} ${a_partition_working[1]}$partition_used$full_dev$full_label$full_uuid "
|
||||
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$partitionIdClean ${C1}size:${C2} ${a_partition_working[1]}$partition_used$full_dev$full_fs$full_label$full_uuid "
|
||||
|
||||
if [[ $( wc -c <<< ${a_partition_data[$counter]} ) -gt $line_max ]];then
|
||||
((counter++))
|
||||
|
|
Loading…
Reference in a new issue