small fix in distro id to handle incorrectly arch linux /etc/lsb-release file.

Normally we won't fix such things, which are just bugs in the distro, but in this case,
since there's now an overall failsafe, that can be used for all future distros that might
make the same mistake.

But please, tighten up your standards distro, this is a small file, and it's not hard to fill
it out right, is it? Or is it?
This commit is contained in:
inxi-svn 2010-09-30 00:46:02 +00:00
parent 819fb339d8
commit 15430ba3ab

24
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.4.17 #### version: 1.4.18
#### Date: September 29 2010 #### Date: September 29 2010
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -2255,9 +2255,27 @@ get_distro_lsb_data()
distroCodename = $NF " " distroCodename = $NF " "
} }
} }
# sometimes some distros cannot do their lsb-release files correctly, so here is
# one last chance to get it right.
/^DISTRIB_DESCRIPTION/ {
gsub(/^ +| +$/, "", $0)
if ( $NF != "n/a" ) {
# slice out the part inside "", like: DISTRIB_DESCRIPTION="Arch Linux"
gsub(/DISTRIB_DESCRIPTION=|"/,"",$0)
distroDescription = $0
}
}
END { END {
print distroId distroRelease distroCodename fullString=""
}' $FILE_LSB_RELEASE ) if ( distroId == "" && distroRelease == "" && distroCodename == "" && distroDescription != "" ){
fullString = distroDescription
}
else {
fullString = distroId distroRelease distroCodename
}
print fullString
}
' $FILE_LSB_RELEASE )
log_function_data 'cat' "$FILE_LSB_RELEASE" log_function_data 'cat' "$FILE_LSB_RELEASE"
fi fi
# this is HORRIBLY slow, but I don't know why, it runs fast in shell # this is HORRIBLY slow, but I don't know why, it runs fast in shell