mirror of
https://github.com/smxi/inxi.git
synced 2025-01-31 10:02:18 +00:00
New version, new tarball. This fixes a possible bug with using --total to calculate disk
used percentage, there are too many possible remote file systems to safely exclude, so sticking with using the test that partition is /dev mounted. Howeve, did add excludes of nfs/smbfs types, as well as future bsd excludes of those.
This commit is contained in:
parent
ec1a27a66c
commit
1899d411ed
29
inxi
29
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 2.1.24
|
#### Version: 2.1.25
|
||||||
#### Date: 2014-04-28
|
#### Date: 2014-04-28
|
||||||
#### Patch Number: 00
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -5411,18 +5411,14 @@ get_graphics_display_server_version()
|
||||||
get_hdd_data_basic()
|
get_hdd_data_basic()
|
||||||
{
|
{
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
local hdd_used='' a_temp='' df_string='' df_total=''
|
local hdd_used='' a_temp='' df_string=''
|
||||||
local hdd_data='' df_test='' b_total='false' swap_size=0
|
local hdd_data='' df_test='' swap_size=0
|
||||||
|
|
||||||
if [[ -z $BSD_TYPE ]];then
|
if [[ -z $BSD_TYPE ]];then
|
||||||
## NOTE: older df do not have --total (eg: v: 6.10 2008)
|
## NOTE: older df do not have --total (eg: v: 6.10 2008)
|
||||||
## keep in mind the only value of use with --total is 'used' in blocks, which
|
## keep in mind the only value of use with --total is 'used' in blocks, which
|
||||||
## we can use later to calculate the real percentags based on disk sizes, not
|
## we can use later to calculate the real percentags based on disk sizes, not
|
||||||
## mounted partitions
|
## mounted partitions. Not using --total because it's more reliable to exclude non /dev
|
||||||
if df -P -T --total &>/dev/null;then
|
|
||||||
b_total='true'
|
|
||||||
df_total=' --total'
|
|
||||||
fi
|
|
||||||
df_string="df -P -T --exclude-type=aufs --exclude-type=devfs --exclude-type=devtmpfs
|
df_string="df -P -T --exclude-type=aufs --exclude-type=devfs --exclude-type=devtmpfs
|
||||||
--exclude-type=fdescfs --exclude-type=iso9660 --exclude-type=linprocfs --exclude-type=nfs
|
--exclude-type=fdescfs --exclude-type=iso9660 --exclude-type=linprocfs --exclude-type=nfs
|
||||||
--exclude-type=nfs3 --exclude-type=nfs4 --exclude-type=nfs5 --exclude-type=procfs --exclude-type=smbfs
|
--exclude-type=nfs3 --exclude-type=nfs4 --exclude-type=nfs5 --exclude-type=procfs --exclude-type=smbfs
|
||||||
|
@ -5471,7 +5467,7 @@ get_hdd_data_basic()
|
||||||
hdd_data="$( eval $df_string )"
|
hdd_data="$( eval $df_string )"
|
||||||
# eval $df_string | awk 'BEGIN{tot=0} !/total/ {tot+=$4} END{print tot}'
|
# eval $df_string | awk 'BEGIN{tot=0} !/total/ {tot+=$4} END{print tot}'
|
||||||
log_function_data 'raw' "hdd_data:\n$hdd_data"
|
log_function_data 'raw' "hdd_data:\n$hdd_data"
|
||||||
hdd_used=$( echo "$hdd_data" | gawk -v bsdType=$BSD_TYPE -v bTotal=$b_total -v swapSize=$swap_size '
|
hdd_used=$( echo "$hdd_data" | gawk -v bsdType=$BSD_TYPE -v swapSize=$swap_size '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
# this is used for specific cases where bind, or incorrect multiple mounts to same partitions,
|
# this is used for specific cases where bind, or incorrect multiple mounts to same partitions,
|
||||||
# is present. The value is searched for an earlier appearance of that partition and if it is
|
# is present. The value is searched for an earlier appearance of that partition and if it is
|
||||||
|
@ -5483,19 +5479,8 @@ get_hdd_data_basic()
|
||||||
mountWorking=""
|
mountWorking=""
|
||||||
used=0
|
used=0
|
||||||
}
|
}
|
||||||
# do this first to skip the other tests, if we have the totals, we do not need to calculate them
|
|
||||||
# note there is a risk to this because if a new fs to exclude is present but not excluded
|
|
||||||
# this will include that size data. So far bsd df does not support --exculde-type
|
|
||||||
( bsdType == "" ) && ( bTotal == "true" ) {
|
|
||||||
while ( $1 !~ /^total/ ) {
|
|
||||||
next
|
|
||||||
}
|
|
||||||
if ($1 ~ /^total/ && $4 ~ /^[0-9]+$/ ) {
|
|
||||||
used = $4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# using $1, not $2, because older bsd df do not have -T, filesystem type
|
# using $1, not $2, because older bsd df do not have -T, filesystem type
|
||||||
( bsdType != "" ) && $1 ~ /^(aufs|devfs|devtmpfs|fdescfs|filesystem|iso9660|linprocfs|procfs|squashfs|sysfs|tmpfs|type|unionfs)$/ {
|
( bsdType != "" ) && $1 ~ /^(aufs|devfs|devtmpfs|fdescfs|filesystem|iso9660|linprocfs|nfs|nfs3|nfs4|nfs5|procfs|squashfs|smbfs|sysfs|tmpfs|type|unionfs)$/ {
|
||||||
# note use next, not getline or it does not work right
|
# note use next, not getline or it does not work right
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -5503,7 +5488,7 @@ get_hdd_data_basic()
|
||||||
# note that linux 3.2.45-grsec-9th types kernels have this type of partition name: /dev/xvdc (no number, letter)
|
# note that linux 3.2.45-grsec-9th types kernels have this type of partition name: /dev/xvdc (no number, letter)
|
||||||
# note: btrfs does not seem to use partition integers, just the primary /dev/sdx identifier
|
# note: btrfs does not seem to use partition integers, just the primary /dev/sdx identifier
|
||||||
# df can also show /dev/disk/(by-label|by-uuid etc)
|
# df can also show /dev/disk/(by-label|by-uuid etc)
|
||||||
( bTotal == "false" ) && /^\/dev\/(disk\/|mapper\/|[hsv]d[a-z][0-9]*|dm[-]?[0-9]+|ada[0-9]+p[0-9]+.*|md[0-9]+|[aw]d[0-9]+s.*|xvd[a-z])/ {
|
/^\/dev\/(disk\/|mapper\/|[hsv]d[a-z][0-9]*|dm[-]?[0-9]+|ada[0-9]+p[0-9]+.*|md[0-9]+|[aw]d[0-9]+s.*|xvd[a-z])/ {
|
||||||
# this handles the case where the first item is too long
|
# this handles the case where the first item is too long
|
||||||
# and makes df wrap output to next line, so here we advance
|
# and makes df wrap output to next line, so here we advance
|
||||||
# it to the next line for that single case. Using df -P should
|
# it to the next line for that single case. Using df -P should
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
=====================================================================================
|
||||||
|
Version: 2.1.25
|
||||||
|
Patch Version: 00
|
||||||
|
Script Date: 2014-04-28
|
||||||
|
-----------------------------------
|
||||||
|
Changes:
|
||||||
|
-----------------------------------
|
||||||
|
New version, new tarball. This fixes a possible bug with using --total to calculate disk
|
||||||
|
used percentage, there are too many possible remote file systems to safely exclude, so
|
||||||
|
sticking with using the test that partition is /dev mounted.
|
||||||
|
|
||||||
|
Howeve, did add excludes of nfs/smbfs types, as well as future bsd excludes of those.
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
-- Harald Hope - Mon, 28 Apr 2014 14:23:39 -0700
|
||||||
|
|
||||||
=====================================================================================
|
=====================================================================================
|
||||||
Version: 2.1.24
|
Version: 2.1.24
|
||||||
Patch Version: 00
|
Patch Version: 00
|
||||||
|
|
Loading…
Reference in a new issue