bug fix, new kernels/df show both / real filesystem and / and rootfs, creating double / entries.

This is fixed with a simple test to get rid of that possible outcome. We'll see if that's sufficient.
This commit is contained in:
inxi-svn 2012-02-09 23:35:47 +00:00
parent f63cf11e2c
commit e7fd174440

11
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.7.28 #### version: 1.7.29
#### Date: January 7 2012 #### Date: February 9 2012
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -4945,6 +4945,13 @@ get_partition_data()
log_function_data 'raw' "main_partition_data:\n$main_partition_data\n\nswap_data:\n$swap_data" log_function_data 'raw' "main_partition_data:\n$main_partition_data\n\nswap_data:\n$swap_data"
# new kernels/df have rootfs and / repeated, creating two entries for the same partition
# so check for two string endings of / then slice out the rootfs one, I could check for it
# before slicing it out, but doing that would require the same action twice re code execution
if [[ $( grep -cs '[[:space:]]/$' <<< "$main_partition_data" ) -gt 1 ]];then
main_partition_data="$( grep -vs 'rootfs' <<< "$main_partition_data" )"
fi
log_function_data 'post-rootfs-filter' "main_partition_data:\n$main_partition_data\n\nswap_data:\n$swap_data"
IFS=$'\n' IFS=$'\n'
# sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home # sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home
# $NF = partition name; $(NF - 4) = partition size; $(NF - 3) = used, in gB; $(NF - 1) = percent used # $NF = partition name; $(NF - 4) = partition size; $(NF - 3) = used, in gB; $(NF - 1) = percent used