mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
fixed a bug where if disk has > 9 partions, label would repeat for root for all of them > 9
This commit is contained in:
parent
2e75681f83
commit
106c4878f1
15
inxi
15
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.4.15
|
#### version: 1.4.16
|
||||||
#### Date: September 16 2010
|
#### Date: September 26 2010
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -3153,7 +3153,7 @@ get_partition_data()
|
||||||
if [[ -n $( grep -E '(by-uuid|by-label)' <<< ${a_partition_working[6]} ) ]];then
|
if [[ -n $( grep -E '(by-uuid|by-label)' <<< ${a_partition_working[6]} ) ]];then
|
||||||
if [[ -n $DEV_DISK_UUID ]];then
|
if [[ -n $DEV_DISK_UUID ]];then
|
||||||
dev_item=$( echo "$DEV_DISK_UUID" | gawk '
|
dev_item=$( echo "$DEV_DISK_UUID" | gawk '
|
||||||
/'$( basename ${a_partition_working[6]} )'/ {
|
/'$( basename ${a_partition_working[6]} )'$/ {
|
||||||
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
||||||
print item
|
print item
|
||||||
}' )
|
}' )
|
||||||
|
@ -3161,7 +3161,7 @@ get_partition_data()
|
||||||
# if we didn't find anything for uuid try label
|
# if we didn't find anything for uuid try label
|
||||||
if [[ -z $dev_item && -n $DEV_DISK_LABEL ]];then
|
if [[ -z $dev_item && -n $DEV_DISK_LABEL ]];then
|
||||||
dev_item=$( echo "$DEV_DISK_LABEL" | gawk '
|
dev_item=$( echo "$DEV_DISK_LABEL" | gawk '
|
||||||
/'$( basename ${a_partition_working[6]} )'/ {
|
/'$( basename ${a_partition_working[6]} )'$/ {
|
||||||
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
item=gensub( /..\/..\/(.+)/, "\\1", 1, $NF )
|
||||||
print item
|
print item
|
||||||
}' )
|
}' )
|
||||||
|
@ -3234,7 +3234,7 @@ get_partition_data_advanced()
|
||||||
# if this works, great, otherwise, just set this to null values
|
# if this works, great, otherwise, just set this to null values
|
||||||
partTemp="'$( readlink /dev/root 2>/dev/null )'"
|
partTemp="'$( readlink /dev/root 2>/dev/null )'"
|
||||||
if ( partTemp != "" ) {
|
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 )
|
partition=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, partTemp )
|
||||||
}
|
}
|
||||||
else if ( partTemp ~ /by-uuid/ ) {
|
else if ( partTemp ~ /by-uuid/ ) {
|
||||||
|
@ -3297,7 +3297,7 @@ get_partition_data_advanced()
|
||||||
fi
|
fi
|
||||||
if [[ -n $DEV_DISK_LABEL ]] && [[ -n $dev_item && -z $dev_label ]];then
|
if [[ -n $DEV_DISK_LABEL ]] && [[ -n $dev_item && -z $dev_label ]];then
|
||||||
dev_label=$( echo "$DEV_DISK_LABEL" | gawk '
|
dev_label=$( echo "$DEV_DISK_LABEL" | gawk '
|
||||||
/'$dev_item'/ {
|
/'$dev_item'$/ {
|
||||||
print $(NF - 2)
|
print $(NF - 2)
|
||||||
}' )
|
}' )
|
||||||
fi
|
fi
|
||||||
|
@ -3951,7 +3951,7 @@ get_unmounted_partition_data()
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
A_UNMOUNTED_PARTITION_DATA=( $( grep -Ev '('$mounted_partitions')' $FILE_PARTITIONS | gawk '
|
A_UNMOUNTED_PARTITION_DATA=( $( grep -Ev '('$mounted_partitions')$' $FILE_PARTITIONS | gawk '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
IGNORECASE=1
|
IGNORECASE=1
|
||||||
}
|
}
|
||||||
|
@ -4014,6 +4014,7 @@ get_unmounted_partition_filesystem()
|
||||||
fi
|
fi
|
||||||
# this will fail if regular user and no sudo present, but that's fine, it will just return null
|
# 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
|
# 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 '.*' )
|
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
|
if [[ -n $partition_filesystem ]];then
|
||||||
echo $partition_filesystem
|
echo $partition_filesystem
|
||||||
|
|
Loading…
Reference in a new issue