From 106c4878f1d90c1813acaaf4877fb8b9d68575e3 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sun, 26 Sep 2010 21:59:16 +0000 Subject: [PATCH] fixed a bug where if disk has > 9 partions, label would repeat for root for all of them > 9 --- inxi | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/inxi b/inxi index 93e3c5a..117ef3f 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.15 -#### Date: September 16 2010 +#### version: 1.4.16 +#### Date: September 26 2010 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -3153,7 +3153,7 @@ get_partition_data() if [[ -n $( grep -E '(by-uuid|by-label)' <<< ${a_partition_working[6]} ) ]];then if [[ -n $DEV_DISK_UUID ]];then dev_item=$( echo "$DEV_DISK_UUID" | gawk ' - /'$( basename ${a_partition_working[6]} )'/ { + /'$( basename ${a_partition_working[6]} )'$/ { item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF ) print item }' ) @@ -3161,7 +3161,7 @@ get_partition_data() # if we didn't find anything for uuid try label if [[ -z $dev_item && -n $DEV_DISK_LABEL ]];then dev_item=$( echo "$DEV_DISK_LABEL" | gawk ' - /'$( basename ${a_partition_working[6]} )'/ { + /'$( basename ${a_partition_working[6]} )'$/ { item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF ) print item }' ) @@ -3234,7 +3234,7 @@ get_partition_data_advanced() # if this works, great, otherwise, just set this to null values partTemp="'$( readlink /dev/root 2>/dev/null )'" if ( partTemp != "" ) { - if ( partTemp ~ /[hs]d[a-z][0-9]/ ) { + if ( partTemp ~ /[hs]d[a-z][0-9]{1,2}/ ) { partition=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, partTemp ) } else if ( partTemp ~ /by-uuid/ ) { @@ -3297,7 +3297,7 @@ get_partition_data_advanced() fi if [[ -n $DEV_DISK_LABEL ]] && [[ -n $dev_item && -z $dev_label ]];then dev_label=$( echo "$DEV_DISK_LABEL" | gawk ' - /'$dev_item'/ { + /'$dev_item'$/ { print $(NF - 2) }' ) fi @@ -3951,7 +3951,7 @@ get_unmounted_partition_data() fi done - A_UNMOUNTED_PARTITION_DATA=( $( grep -Ev '('$mounted_partitions')' $FILE_PARTITIONS | gawk ' + A_UNMOUNTED_PARTITION_DATA=( $( grep -Ev '('$mounted_partitions')$' $FILE_PARTITIONS | gawk ' BEGIN { IGNORECASE=1 } @@ -4014,6 +4014,7 @@ get_unmounted_partition_filesystem() fi # this will fail if regular user and no sudo present, but that's fine, it will just return null # note the hack that simply slices out the first line if > 1 items found in string + # also, if grub/lilo is on partition boot sector, no file system data is available partition_filesystem=$( eval $sudo_command $FILE_PATH -s $1 | grep -Eio '(ext2|ext3|ext4|ext5|ext[[:space:]]|ntfs|fat32|fat16|fat[[:space:]]\(.*\)|vfat|fatx|tfat|swap|btrfs|ffs[[:space:]]|hfs\+|hfs[[:space:]]plus|hfs[[:space:]]extended[[:space:]]version[[:space:]][1-9]|hfsj|hfs[[:space:]]|jfs[[:space:]]|nss[[:space:]]|reiserfs|reiser4|ufs2|ufs[[:space:]]|xfs[[:space:]]|zfs[[:space:]])' | grep -Em 1 '.*' ) if [[ -n $partition_filesystem ]];then echo $partition_filesystem