mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
New version, new tarball, new man. Found a pesky bug with false disk used results.
It turns out I'd neglected to include /dev/disk partitions, oops, in the df data. Since this is a long time bug, it warrants a new release even though I just did 2.1.22.
This commit is contained in:
parent
0232318b18
commit
1f57eae5bb
16
inxi
16
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 2.1.22
|
#### Version: 2.1.23
|
||||||
#### Date: 2014-04-27
|
#### Date: 2014-04-27
|
||||||
#### Patch Number: 00
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -5437,14 +5437,18 @@ get_hdd_data_basic()
|
||||||
total=0
|
total=0
|
||||||
}
|
}
|
||||||
( $2 == "partition" ) && ( $3 ~ /^[0-9]+$/ ) {
|
( $2 == "partition" ) && ( $3 ~ /^[0-9]+$/ ) {
|
||||||
total = total + $3
|
total += ( 1000 / 1024 ) * $3
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
|
# result in kB, change to 1024 Byte blocks
|
||||||
|
total = total * 1000 / 1024
|
||||||
|
total = sprintf( "%.1f", total )
|
||||||
print total
|
print total
|
||||||
}' )
|
}' )
|
||||||
fi
|
fi
|
||||||
# echo ss: $swap_size
|
# echo ss: $swap_size
|
||||||
hdd_data="$( eval $df_string )"
|
hdd_data="$( eval $df_string )"
|
||||||
|
# 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 bTotal=$b_total -v swapSize=$swap_size '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
@ -5456,6 +5460,7 @@ get_hdd_data_basic()
|
||||||
devSet=""
|
devSet=""
|
||||||
devWorking=""
|
devWorking=""
|
||||||
mountWorking=""
|
mountWorking=""
|
||||||
|
used=0
|
||||||
}
|
}
|
||||||
# do this first to skip the other tests, if we have the totals, we do not need to calculate them
|
# 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
|
# note there is a risk to this because if a new fs to exclude is present but not excluded
|
||||||
|
@ -5476,7 +5481,8 @@ get_hdd_data_basic()
|
||||||
# also handles odd dm-1 type, from lvm, and mdraid, and some other bsd partition syntax
|
# also handles odd dm-1 type, from lvm, and mdraid, and some other bsd partition syntax
|
||||||
# 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
|
||||||
( bTotal == "false" ) && /^\/dev\/(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])[[:space:]]/ {
|
# 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])/ {
|
||||||
# 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
|
||||||
|
@ -5519,6 +5525,7 @@ get_hdd_data_basic()
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
used=used + swapSize
|
used=used + swapSize
|
||||||
|
used = sprintf( "%.1f", used )
|
||||||
print used
|
print used
|
||||||
}' )
|
}' )
|
||||||
# echo hdu:$hdd_used
|
# echo hdu:$hdd_used
|
||||||
|
@ -5533,7 +5540,7 @@ get_hdd_data_basic()
|
||||||
|
|
||||||
if [[ $B_PARTITIONS_FILE == 'true' ]];then
|
if [[ $B_PARTITIONS_FILE == 'true' ]];then
|
||||||
A_HDD_DATA=( $(
|
A_HDD_DATA=( $(
|
||||||
gawk -v hddUsed="$hdd_used" '
|
gawk -v hddUsed=$hdd_used '
|
||||||
/[hsv]d[a-z]$/ {
|
/[hsv]d[a-z]$/ {
|
||||||
driveSize = $(NF - 1)*1024/1000**3
|
driveSize = $(NF - 1)*1024/1000**3
|
||||||
gsub(/,/, " ", driveSize)
|
gsub(/,/, " ", driveSize)
|
||||||
|
@ -5571,6 +5578,7 @@ get_hdd_data_basic()
|
||||||
fi
|
fi
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
a_temp=${A_HDD_DATA[@]}
|
a_temp=${A_HDD_DATA[@]}
|
||||||
|
# echo ${a_temp[@]}
|
||||||
log_function_data "A_HDD_DATA: $a_temp"
|
log_function_data "A_HDD_DATA: $a_temp"
|
||||||
eval $LOGFE
|
eval $LOGFE
|
||||||
}
|
}
|
||||||
|
|
7
inxi.1
7
inxi.1
|
@ -80,11 +80,12 @@ Shows optical drive data. Same as \fB\-Dd\fR. With \fB\-x\fR, adds features line
|
||||||
\fB\-xx\fR adds a few more features.
|
\fB\-xx\fR adds a few more features.
|
||||||
.TP
|
.TP
|
||||||
.B \-D
|
.B \-D
|
||||||
Show full hard Disk info, not only model, ie: \fB/dev/sda ST380817AS 80.0GB. Shows disk space
|
Show full hard Disk info, not only model, ie: \fB/dev/sda ST380817AS 80.0GB\fR. Shows disk space
|
||||||
total + used percentage. The disk used percentage includes space used by swap partition(s), since
|
total + used percentage. The disk used percentage includes space used by swap partition(s), since
|
||||||
those are not usable for data storage. Note that with RAID disks, the percentage will be wrong
|
those are not usable for data storage. Note that with RAID disks, the percentage will be wrong
|
||||||
since the total is computed from the disk sizes, but the used is computed from partition used
|
since the total is computed from the disk sizes, but the used is computed from mounted partition used
|
||||||
percentages. This small defect may get corrected in the future.
|
percentages. This small defect may get corrected in the future. Also, unmounted partitions are not
|
||||||
|
counted in disk use percentages since inxi has no access to that data.
|
||||||
.TP
|
.TP
|
||||||
.B \-f
|
.B \-f
|
||||||
Show all cpu flags used, not just the short list. Not shown with \fB\-F\fR to avoid
|
Show all cpu flags used, not just the short list. Not shown with \fB\-F\fR to avoid
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
=====================================================================================
|
||||||
|
Version: 2.1.23
|
||||||
|
Patch Version: 00
|
||||||
|
Script Date: 2014-04-27
|
||||||
|
-----------------------------------
|
||||||
|
Changes:
|
||||||
|
-----------------------------------
|
||||||
|
New version, new tarball, new man. Found a pesky bug with false disk used results.
|
||||||
|
|
||||||
|
It turns out I'd neglected to include /dev/disk partitions, oops, in the df data.
|
||||||
|
|
||||||
|
Since this is a long time bug, it warrants a new release even though I just did
|
||||||
|
2.1.22.
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
-- Harald Hope - Sun, 27 Apr 2014 15:55:20 -0700
|
||||||
|
|
||||||
=====================================================================================
|
=====================================================================================
|
||||||
Version: 2.1.22
|
Version: 2.1.22
|
||||||
Patch Version: 00
|
Patch Version: 00
|
||||||
|
|
Loading…
Reference in a new issue