mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
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:
parent
819fb339d8
commit
15430ba3ab
24
inxi
24
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.4.17
|
||||
#### version: 1.4.18
|
||||
#### Date: September 29 2010
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -2255,9 +2255,27 @@ get_distro_lsb_data()
|
|||
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 {
|
||||
print distroId distroRelease distroCodename
|
||||
}' $FILE_LSB_RELEASE )
|
||||
fullString=""
|
||||
if ( distroId == "" && distroRelease == "" && distroCodename == "" && distroDescription != "" ){
|
||||
fullString = distroDescription
|
||||
}
|
||||
else {
|
||||
fullString = distroId distroRelease distroCodename
|
||||
}
|
||||
print fullString
|
||||
}
|
||||
' $FILE_LSB_RELEASE )
|
||||
log_function_data 'cat' "$FILE_LSB_RELEASE"
|
||||
fi
|
||||
# this is HORRIBLY slow, but I don't know why, it runs fast in shell
|
||||
|
|
Loading…
Reference in a new issue