mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
bsd tests
This commit is contained in:
parent
83ebf9a41f
commit
80f6061580
20
inxi
20
inxi
|
@ -6928,7 +6928,7 @@ get_partition_data()
|
|||
eval $LOGFS
|
||||
|
||||
local a_partition_working='' dev_item='' a_temp='' dev_working_item=''
|
||||
local swap_data='' df_string='' main_partition_data='' df_test='' fs_type=''
|
||||
local swap_data='' df_string='' main_partition_data='' fs_type=''
|
||||
local mount_data='' dev_bsd_item=''
|
||||
#local excluded_file_types='--exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660'
|
||||
# df doesn't seem to work in script with variables like at the command line
|
||||
|
@ -6942,8 +6942,7 @@ get_partition_data()
|
|||
swap_data="$( swapctl -l 2>/dev/null )"
|
||||
# default size is 512, -H only for size in human readable format
|
||||
# older bsds don't support -T, pain, so we'll use partial output there
|
||||
df_test=$( df -H -T 2>/dev/null )
|
||||
if [[ -n $df_test ]];then
|
||||
if df -H -T &>/dev/null;then
|
||||
df_string='df -H -T'
|
||||
else
|
||||
df_string='df -H'
|
||||
|
@ -6969,7 +6968,7 @@ get_partition_data()
|
|||
# $NF = partition name; $(NF - 4) = partition size; $(NF - 3) = used, in gB; $(NF - 1) = percent used
|
||||
## note: by subtracting from the last field number NF, we avoid a subtle issue with LVM df output, where if
|
||||
## the first field is too long, it will occupy its own line, this way we are getting only the needed data
|
||||
A_PARTITION_DATA=( $( echo "$main_partition_data" | gawk -v bsdType=$BSD_TYPE '
|
||||
A_PARTITION_DATA=( $( echo "$main_partition_data" | gawk -v bsdType=$BSD_TYPE -v bsdVersion=$BSD_VERSION '
|
||||
BEGIN {
|
||||
IGNORECASE=1
|
||||
fileSystem=""
|
||||
|
@ -7016,7 +7015,12 @@ get_partition_data()
|
|||
else {
|
||||
fileSystem=""
|
||||
}
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main," fileSystem "," devBase
|
||||
if ( bsdVersion != "darwin" ) {
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main," fileSystem "," devBase
|
||||
}
|
||||
else {
|
||||
print $NF "," $(NF - 7) "," $(NF - 6) "," $(NF - 4) ",main," fileSystem "," devBase
|
||||
}
|
||||
}
|
||||
# skip all these, including the first, header line. Use the --exclude-type
|
||||
# to handle new filesystems types we do not want listed here
|
||||
|
@ -7024,7 +7028,11 @@ get_partition_data()
|
|||
# this is to avoid file systems with spaces in their names, that will make
|
||||
# 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]+%/ ) {
|
||||
if ( bsdVersion == "darwin" && $(NF - 4) ~ /[0-9]+%/ ) {
|
||||
fileSystem=""
|
||||
print $NF "," $(NF - 7) "," $(NF - 6) "," $(NF - 4) ",main," fileSystem "," devBase
|
||||
}
|
||||
else if ( $(NF - 1) ~ /[0-9]+%/ ) {
|
||||
# note, older df in bsd do not have file system column
|
||||
if ( NF == "7" ) {
|
||||
fileSystem=$(NF - 5)
|
||||
|
|
Loading…
Reference in a new issue