mirror of
https://github.com/smxi/inxi.git
synced 2025-01-31 18:12:21 +00:00
New version, tarball. This fixes one small oversight, placing USB in front of ID-[x]
of disk drive lists. Was showing USB ID-1: /dev/sde now shows: ID-1: USB /dev/sde that is more intuitive and keeps the columns in alignment more or less, easier to read. Second, fixes a bug with some file systems / usb drives where they do not use usb- in the /dev/disk/by-id line but only wwn- https://access.redhat.com/site/documentation/en -US/Red_Hat_Enterprise_Linux/5/html/Online_Storage_Reconfiguration_Guide/persistent_naming.html explains it somewhat. the fix is adding a second if null test of the device /dev/sdx in by-path, that seems to fix the issue. by-path does have the usb- item, though it does not have the name so it's not as reliable in absolute terms, but it's fine as a second step fallback option.
This commit is contained in:
parent
9ceb7b8cb1
commit
cafa625166
18
inxi
18
inxi
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### Version: 2.1.20
|
#### Version: 2.1.21
|
||||||
#### Date: 2014-04-08
|
#### Date: 2014-04-24
|
||||||
#### Patch Number: 00
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
|
@ -1763,6 +1763,8 @@ debug_data_collector()
|
||||||
ls -l /dev/disk/by-id &> $debug_data_dir/dev-disk-id-data.txt
|
ls -l /dev/disk/by-id &> $debug_data_dir/dev-disk-id-data.txt
|
||||||
ls -l /dev/disk/by-label &> $debug_data_dir/dev-disk-label-data.txt
|
ls -l /dev/disk/by-label &> $debug_data_dir/dev-disk-label-data.txt
|
||||||
ls -l /dev/disk/by-uuid &> $debug_data_dir/dev-disk-uuid-data.txt
|
ls -l /dev/disk/by-uuid &> $debug_data_dir/dev-disk-uuid-data.txt
|
||||||
|
# http://comments.gmane.org/gmane.linux.file-systems.zfs.user/2032
|
||||||
|
ls -l /dev/disk/by-wwn &> $debug_data_dir/dev-disk-wwn-data.txt
|
||||||
ls -l /dev/disk/by-path &> $debug_data_dir/dev-disk-path-data.txt
|
ls -l /dev/disk/by-path &> $debug_data_dir/dev-disk-path-data.txt
|
||||||
ls -l /dev/mapper &> $debug_data_dir/dev-disk-mapper-data.txt
|
ls -l /dev/mapper &> $debug_data_dir/dev-disk-mapper-data.txt
|
||||||
readlink /dev/root &> $debug_data_dir/dev-root.txt
|
readlink /dev/root &> $debug_data_dir/dev-root.txt
|
||||||
|
@ -5544,7 +5546,7 @@ get_hard_drive_data_advanced()
|
||||||
{
|
{
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
local a_temp_working='' a_temp_scsi='' temp_holder='' temp_name='' i='' j=''
|
local a_temp_working='' a_temp_scsi='' temp_holder='' temp_name='' i='' j=''
|
||||||
local sd_ls_by_id='' ls_disk_by_id='' usb_exists='' a_temp=''
|
local sd_ls_by_id='' ls_disk_by_id='' ls_disk_by_path='' usb_exists='' a_temp=''
|
||||||
|
|
||||||
## check for all ide type drives, non libata, only do it if hdx is in array
|
## check for all ide type drives, non libata, only do it if hdx is in array
|
||||||
## this is now being updated for new /sys type paths, this may handle that ok too
|
## this is now being updated for new /sys type paths, this may handle that ok too
|
||||||
|
@ -5614,6 +5616,7 @@ get_hard_drive_data_advanced()
|
||||||
# first pack the main ls variable so we don't have to keep using ls /dev...
|
# first pack the main ls variable so we don't have to keep using ls /dev...
|
||||||
# not all systems have /dev/disk/by-id
|
# not all systems have /dev/disk/by-id
|
||||||
ls_disk_by_id="$( ls -l /dev/disk/by-id 2>/dev/null )"
|
ls_disk_by_id="$( ls -l /dev/disk/by-id 2>/dev/null )"
|
||||||
|
ls_disk_by_path="$( ls -l /dev/disk/by-path 2>/dev/null )"
|
||||||
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
|
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
|
||||||
do
|
do
|
||||||
if [[ -n $( grep -E '^sd[a-z]' <<< ${A_HDD_DATA[$i]} ) ]];then
|
if [[ -n $( grep -E '^sd[a-z]' <<< ${A_HDD_DATA[$i]} ) ]];then
|
||||||
|
@ -5648,8 +5651,13 @@ get_hard_drive_data_advanced()
|
||||||
|
|
||||||
if [[ -z $temp_name ]];then
|
if [[ -z $temp_name ]];then
|
||||||
temp_name="Name n/a"
|
temp_name="Name n/a"
|
||||||
|
# maybe remove this from the conditional, detection of usb may not depend on the name
|
||||||
else
|
else
|
||||||
usb_exists=$( grep -Em1 "usb-.*$temp_name.*${a_temp_working[0]}$" <<< "$ls_disk_by_id" )
|
usb_exists=$( grep -Em1 "usb-.*$temp_name.*${a_temp_working[0]}$" <<< "$ls_disk_by_id" )
|
||||||
|
# note: sometimes with wwn- numbering usb does not appear in by-id but it does in by-path
|
||||||
|
if [[ -z $usb_exists ]];then
|
||||||
|
usb_exists=$( grep -Em1 "usb-.*${a_temp_working[0]}$" <<< "$ls_disk_by_path" )
|
||||||
|
fi
|
||||||
if [[ -n $usb_exists ]];then
|
if [[ -n $usb_exists ]];then
|
||||||
a_temp_working[3]='USB'
|
a_temp_working[3]='USB'
|
||||||
fi
|
fi
|
||||||
|
@ -9919,7 +9927,7 @@ print_hard_disk_data()
|
||||||
fi
|
fi
|
||||||
hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial"
|
hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial"
|
||||||
fi
|
fi
|
||||||
dev_data="${C1}ID-$((i+1))$SEP3${C2} /dev/${a_hdd_working[0]} "
|
dev_data="/dev/${a_hdd_working[0]} "
|
||||||
fi
|
fi
|
||||||
if [[ -n ${a_hdd_working[2]} ]];then
|
if [[ -n ${a_hdd_working[2]} ]];then
|
||||||
hdd_name_temp=${a_hdd_working[2]}
|
hdd_name_temp=${a_hdd_working[2]}
|
||||||
|
@ -9928,7 +9936,7 @@ print_hard_disk_data()
|
||||||
fi
|
fi
|
||||||
# echo "loop: $i"
|
# echo "loop: $i"
|
||||||
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
|
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
|
||||||
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
|
hdd_string="${C1}ID-$((i+1))$SEP3${C2} $usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
|
||||||
part_1_data="$hdd_model$hdd_string "
|
part_1_data="$hdd_model$hdd_string "
|
||||||
|
|
||||||
if [[ $i -eq 0 ]];then
|
if [[ $i -eq 0 ]];then
|
||||||
|
|
|
@ -1,3 +1,29 @@
|
||||||
|
=====================================================================================
|
||||||
|
Version: 2.1.21
|
||||||
|
Patch Version: 00
|
||||||
|
Script Date: 2014-04-24
|
||||||
|
-----------------------------------
|
||||||
|
Changes:
|
||||||
|
-----------------------------------
|
||||||
|
New version, tarball. This fixes one small oversight, placing USB in front of ID-[x]
|
||||||
|
of disk drive lists. Was showing USB ID-1: /dev/sde now shows: ID-1: USB /dev/sde
|
||||||
|
that is more intuitive and keeps the columns in alignment more or less, easier
|
||||||
|
to read.
|
||||||
|
|
||||||
|
Second, fixes a bug with some file systems / usb drives
|
||||||
|
where they do not use usb- in the /dev/disk/by-id line but only wwn-
|
||||||
|
https://access.redhat.com/site/documentation/en
|
||||||
|
-US/Red_Hat_Enterprise_Linux/5/html/Online_Storage_Reconfiguration_Guide/persistent_naming.html
|
||||||
|
explains it somewhat.
|
||||||
|
|
||||||
|
the fix is adding a second if null test of the device /dev/sdx in by-path, that seems
|
||||||
|
to fix the issue. by-path does have the usb- item, though it does not have the name
|
||||||
|
so it's not as reliable in absolute terms, but it's fine as a second step fallback
|
||||||
|
option.
|
||||||
|
|
||||||
|
-----------------------------------
|
||||||
|
-- Harald Hope - Thu, 24 Apr 2014 11:47:08 -0700
|
||||||
|
|
||||||
=====================================================================================
|
=====================================================================================
|
||||||
Version: 2.1.20
|
Version: 2.1.20
|
||||||
Patch Version: 00
|
Patch Version: 00
|
||||||
|
|
Loading…
Reference in a new issue