Added towol fix for removing second line in alsa version output if compiled by second user

This commit is contained in:
inxi-svn 2008-11-14 20:26:15 +00:00
parent 4249f6980c
commit 3c6c270e68

28
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.5.31 #### version: 0.5.32
#### Date: November 13 2008 #### Date: November 14 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
#### As time permits functionality improvements and recoding will occur. #### As time permits functionality improvements and recoding will occur.
@ -1002,7 +1002,10 @@ get_audio_data()
print driver print driver
} }
}' /proc/asound/cards ) }' /proc/asound/cards )
fi fi\
# this is to safeguard against line breaks from results > 1, which if inserted into following
# array will create a false array entry. This is a hack, not a permanent solution.
alsa_driver=$( echo $alsa_driver )
# this isn't perfect, but if one card was found in lscpci, we're passing # this isn't perfect, but if one card was found in lscpci, we're passing
# this array constructor that card driver name. This should work for most people # this array constructor that card driver name. This should work for most people
# but if you can think of anything better, please post the code patch # but if you can think of anything better, please post the code patch
@ -1046,17 +1049,18 @@ get_audio_alsa_data()
# now we'll get the alsa data if the file exists # now we'll get the alsa data if the file exists
if [[ -e /proc/asound/version ]];then if [[ -e /proc/asound/version ]];then
alsa_data=$( gawk '{ alsa_data=$( gawk '
{ IGNORECASE=1 } { IGNORECASE=1 }
# some alsa strings have the build date in (...) # some alsa strings have the build date in (...)
# also remove trailing . # remove trailing . and remove possible second line if compiled by user
gsub( "Driver | [(].*[)]|\.$","",$0 ) $0 !~ /compile/ {
gsub(/,/, " ", $0) gsub( "Driver | [(].*[)]|\.$","",$0 )
gsub(/^ +| +$/, "", $0) gsub(/,/, " ", $0)
gsub(/ [ \t]+/, " ", $0) gsub(/^ +| +$/, "", $0)
if ( $0 != "" ){ gsub(/ [ \t]+/, " ", $0)
print $0 if ( $0 != "" ){
} print $0
}
}' /proc/asound/version ) }' /proc/asound/version )
fi fi
echo "$alsa_data" echo "$alsa_data"