fixed a glitch in x version, out of x tests can fail if strings contain (...) type endings,

which newer debian's do.
This commit is contained in:
inxi-svn 2011-07-20 04:11:44 +00:00
parent 291fd443b7
commit 6f03cfb351

32
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.7.16 #### version: 1.7.17
#### Date: July 19 2011 #### Date: July 19 2011
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
@ -3927,28 +3927,32 @@ get_graphics_x_data()
get_graphics_x_version() get_graphics_x_version()
{ {
eval $LOGFS eval $LOGFS
local x_version='' local x_version='' x_data=''
# note that some users can have /usr/bin/Xorg but not /usr/bin/X # note that some users can have /usr/bin/Xorg but not /usr/bin/X
if [[ -n $( type -p X ) ]];then if [[ -n $( type -p X ) ]];then
# note: MUST be this syntax: X -version 2>&1 # note: MUST be this syntax: X -version 2>&1
# otherwise X -version overrides everything and this comes out null. # otherwise X -version overrides everything and this comes out null.
# two knowns id strings: X.Org X Server 1.7.5 AND Window System Version 1.7.5 # two knowns id strings: X.Org X Server 1.7.5 AND X Window System Version 1.7.5
#X -version 2>&1 | gawk '/^X Window System Version/ { print $5 }' #X -version 2>&1 | gawk '/^X Window System Version/ { print $5 }'
x_version=$( X -version 2>&1 | gawk ' x_data="$( X -version 2>&1 )"
BEGIN {
IGNORECASE=1
}
/x.org x server|X Window System Version/ {
print $NF
}' )
elif [[ -n $( type -p Xorg ) ]];then elif [[ -n $( type -p Xorg ) ]];then
x_version=$( Xorg -version 2>&1 | gawk ' x_data="$( Xorg -version 2>&1)"
fi
if [[ -n $x_data ]];then
x_version=$(
gawk '
BEGIN { BEGIN {
IGNORECASE=1 IGNORECASE=1
} }
/x.org x server|X Window System Version/ { /^x.org x server/ {
print $NF print $4
}' ) exit
}
/^X Window System Version/ {
print $5
exit
}' <<< "$x_data"
)
fi fi
echo $x_version echo $x_version
log_function_data " x_version: $x_version" log_function_data " x_version: $x_version"