From 9a4e3433c51ad0065ac327f0d156f4bae92e0ac8 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 2 Mar 2009 02:15:06 +0000 Subject: [PATCH] (no version change, but update) Added wrapped mount point output --- inxi | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/inxi b/inxi index be01a9e..5c08eab 100755 --- a/inxi +++ b/inxi @@ -2374,17 +2374,23 @@ get_partition_data() A_PARTITION_DATA=( $( df -h -T --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 | gawk ' BEGIN { IGNORECASE=1 + mountPoint="" } + mountPoint="" # this is required because below we are subtracting from NF, so it has to be # > 1, actually greater than 4, but that is so unlikely to occur because # the real issue is long file system names that force the wrap of df output: //fileserver/main ( NF < 5 ) && ( $0 !~ /[0-9]+\%/ ) { + # set the mount point here for cases of wrapped output + if ( NF == 1 ){ + mountPoint=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 ) + } getline } # this handles yet another fredforfaen special case where a mounted drive # has the search string in its name $NF ~ /^\/$|^\/boot$|^\/var$|^\/home$|^\/tmp$|^\/usr$/ { - print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main" + print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main," mountPoint } # skip all these, including the first, header line. Use the --exclude-type # to handle new filesystems types we do not want listed here @@ -2393,14 +2399,14 @@ get_partition_data() # 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]+\%/ ) { - print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary" + print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary," mountPoint } # these two cases construct the space containing name else if ( $(NF - 2) ~ /[0-9]+\%/ ) { - print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary" + print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary," mountPoint } else if ( $(NF - 3) ~ /[0-9]+\%/ ) { - print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary" + print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary," mountPoint } } ' )