mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
version upgrade
some optimizations, code fixes, handled failed xargs -l case for optical disks
This commit is contained in:
parent
f02a64561c
commit
1635966093
14
inxi
14
inxi
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 1.7.0
|
#### version: 1.7.1
|
||||||
#### Date: June 17 2011
|
#### Date: June 17 2011
|
||||||
#### Patch Number: 05
|
#### Patch Number: 00
|
||||||
########################################################################
|
########################################################################
|
||||||
#### SPECIAL THANKS
|
#### SPECIAL THANKS
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -4504,22 +4504,24 @@ get_optical_drive_data()
|
||||||
{
|
{
|
||||||
eval $LOGFS
|
eval $LOGFS
|
||||||
|
|
||||||
local temp_array='' sys_uevent_path='' proc_cdrom='' link_list='' dev_disks_real=''
|
local temp_array='' sys_uevent_path='' proc_cdrom='' link_list=''
|
||||||
local separator='' linked='' disk='' item_string='' proc_info_string=''
|
local separator='' linked='' disk='' item_string='' proc_info_string=''
|
||||||
local dev_disks_links="$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null )"
|
local dev_disks_links="$( ls /dev/dvd* /dev/cd* /dev/scd* 2>/dev/null )"
|
||||||
# get the actual disk dev location, first try default which is easier to run
|
# get the actual disk dev location, first try default which is easier to run, need to preserve line breaks
|
||||||
dev_disks_real="$( echo "$dev_disks_links" | xargs -l readlink 2>/dev/null | sort -u )"
|
local dev_disks_real="$( echo "$dev_disks_links" | xargs -l readlink 2>/dev/null | sort -u )"
|
||||||
# Some systems don't support xargs -l so we need to do it manually
|
# Some systems don't support xargs -l so we need to do it manually
|
||||||
if [[ -z $dev_disks_real ]];then
|
if [[ -z $dev_disks_real ]];then
|
||||||
for linked in $dev_disks_links
|
for linked in $dev_disks_links
|
||||||
do
|
do
|
||||||
disk=$( readlink $linked 2>/dev/null )
|
disk=$( readlink $linked 2>/dev/null )
|
||||||
if [[ -n $disk ]] && [[ -z $dev_disks_real || -z $( grep $disk <<< $dev_disks_real ) ]];then
|
if [[ -n $disk ]];then
|
||||||
disk=$( basename $disk ) # puppy shows this as /dev/sr0, not sr0
|
disk=$( basename $disk ) # puppy shows this as /dev/sr0, not sr0
|
||||||
|
if [[ -z $dev_disks_real || -z $( grep $disk <<< $dev_disks_real ) ]];then
|
||||||
# need line break IFS for below, no white space
|
# need line break IFS for below, no white space
|
||||||
dev_disks_real="$dev_disks_real$separator$disk"
|
dev_disks_real="$dev_disks_real$separator$disk"
|
||||||
separator=$'\n'
|
separator=$'\n'
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
dev_disks_real="$( sort -u <<< "$dev_disks_real" )"
|
dev_disks_real="$( sort -u <<< "$dev_disks_real" )"
|
||||||
linked=''
|
linked=''
|
||||||
|
|
Loading…
Reference in a new issue