diff --git a/inxi b/inxi index 2f34693..4d06bd7 100755 --- a/inxi +++ b/inxi @@ -2622,7 +2622,7 @@ show_options() print_lines_basic "2" "99" "Global - Overrides/removes all settings. Setting specific removes global." print_lines_basic "1" "-C" "CPU output, including per CPU clockspeed (if available)." print_lines_basic "1" "-d" "Optical drive data. Same as -Dd. See also -x and -xx." - print_lines_basic "1" "-D" "Full hard Disk info, not only model, ie: /dev/sda ST380817AS 80.0GB. See also -x and -xx." + print_lines_basic "1" "-D" "Full hard Disk info, not only model, ie: /dev/sda ST380817AS 80.0GB. See also -x and -xx. Disk total used percentage includes the swap partitions." print_lines_basic "1" "-f" "All cpu flags, triggers -C. Not shown with -F to avoid spamming. ARM cpus show 'features'." print_lines_basic "1" "-F" "Full output for $SCRIPT_NAME. Includes all Upper Case line letters, plus -s and -n. Does not show extra verbose options like -x -d -f -u -l -o -p -t -r" print_lines_basic "1" "-G" "Graphic card information (card, display server type/version, resolution, glx renderer, version)." @@ -5407,7 +5407,7 @@ get_hdd_data_basic() { eval $LOGFS local hdd_used='' a_temp='' df_string='' df_total='' - local hdd_data='' df_test='' b_total='false' + local hdd_data='' df_test='' b_total='false' swap_size=0 if [[ -z $BSD_TYPE ]];then ## NOTE: older df do not have --total (eg: v: 6.10 2008) @@ -5430,9 +5430,23 @@ get_hdd_data_basic() df_string='df -k' fi fi + if swapon -s &>/dev/null;then + swap_size=$( swapon -s 2>/dev/null | gawk ' + BEGIN { + swapSize=0 + total=0 + } + ( $2 == "partition" ) && ( $3 ~ /^[0-9]+$/ ) { + total = total + $3 + } + END { + print total + }' ) + fi + # echo ss: $swap_size hdd_data="$( eval $df_string )" log_function_data 'raw' "hdd_data:\n$hdd_data" - hdd_used=$( echo "$hdd_data" | gawk -v bsdType=$BSD_TYPE -v bTotal=$b_total ' + hdd_used=$( echo "$hdd_data" | gawk -v bsdType=$BSD_TYPE -v bTotal=$b_total -v swapSize=$swap_size ' BEGIN { # 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 @@ -5504,7 +5518,8 @@ get_hdd_data_basic() } } END { - print used + used=used + swapSize + print used }' ) # echo hdu:$hdd_used if [[ -z $hdd_used ]];then diff --git a/inxi.1 b/inxi.1 index b549a26..f48cd34 100755 --- a/inxi.1 +++ b/inxi.1 @@ -1,4 +1,4 @@ -.TH INXI 1 "2014\-04\-14" inxi "inxi manual" +.TH INXI 1 "2014\-04\-27" inxi "inxi manual" .SH NAME inxi \- Command line system information script for console and IRC .SH SYNOPSIS @@ -80,7 +80,11 @@ Shows optical drive data. Same as \fB\-Dd\fR. With \fB\-x\fR, adds features line \fB\-xx\fR adds a few more features. .TP .B \-D -Show full hard Disk info, not only model, ie: \fB/dev/sda ST380817AS 80.0GB. +Show full hard Disk info, not only model, ie: \fB/dev/sda ST380817AS 80.0GB. Shows disk space +total + used percentage. Also, the disk used percentage includes the swap partitions, since +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 +percentages. This small defect may get corrected in the future. .TP .B \-f Show all cpu flags used, not just the short list. Not shown with \fB\-F\fR to avoid diff --git a/inxi.changelog b/inxi.changelog index e97d425..466396b 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,17 @@ +===================================================================================== +Version: 2.1.22 +Patch Version: 00 +Script Date: 2014-04-27 +----------------------------------- +Changes: +----------------------------------- +Quick update to -D, now inxi uses the total partition swap space to calculate the +disk used percentage as well. Since swap space is not available as disk space, it +makes sense to me to count it as used. -P/-p show the percent of swap used as well. + +----------------------------------- +-- Harald Hope - Sun, 27 Apr 2014 14:41:06 -0700 + ===================================================================================== Version: 2.1.22 Patch Version: 00