From 44d8e069dc1cad49342aafba5a793cdc4b5f5b09 Mon Sep 17 00:00:00 2001 From: "trash80.v2.0" Date: Sat, 20 Dec 2008 06:17:06 +0000 Subject: [PATCH] added known good lsb distros --- inxi | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) mode change 100755 => 100644 inxi diff --git a/inxi b/inxi old mode 100755 new mode 100644 index bad8664..7124596 --- a/inxi +++ b/inxi @@ -227,10 +227,11 @@ CN='' ### Distro Data # In cases of derived distros where the version file of the base distro can also be found under /etc, # the derived distro's version file should go first. (Such as with Sabayon / Gentoo) -DISTROS_DERIVED="antix-version kanotix-version knoppix-version redhat-release sabayon-release sidux-version turbolinux-release zenwalk-version" +DISTROS_DERIVED="antix-version kanotix-version knoppix-version sabayon-release sidux-version turbolinux-release zenwalk-version" # debian_version excluded from DISTROS_PRIMARY so Debian can fall through to /etc/issue detection. Same goes for Ubuntu. DISTROS_EXCLUDE_LIST="debian_version ubuntu_version" -DISTROS_PRIMARY="gentoo-release mandrake-release redhat-release slackware-version SuSE-release" +DISTROS_PRIMARY="gentoo-release redhat-release slackware-version SuSE-release mandrake-release mandriva-release" +DISTROS_LSB_GOOD="mandriva-release mandrake-release mandrakelinux-release" ### Bans Data # Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_ban_lists routine @@ -1291,10 +1292,12 @@ get_cpu_data() } # for more on distro id, please reference this python thread: http://bugs.python.org/issue1322 +## hopefully a lsb compliant list will fix this +## lsb-release usage isn't reliable at this time ## return distro name/id if found get_distro_data() { - local i='' distro='' distro_file='' a_distro_glob='' + local i='' j='' distro='' distro_file='' a_distro_glob='' # get the wild carded array of release/version /etc files if present shopt -s nullglob @@ -1317,16 +1320,23 @@ get_distro_data() break fi done - fi - + ## now check for the known good lsb-release distro's + + fi +######################################################################################################################################### # first test for the legacy antiX distro id file if [[ -e /etc/antiX ]];then distro="$( egrep -oi 'antix.*\.iso' <<< $( remove_erroneous_chars '/etc/antiX' ) | sed 's/\.iso//' )" # this handles case where only one release/version file was found, and it's lsb-release. This would # never apply for ubuntu or debian, which will filter down to the following conditions. In general # if there's a specific distro release file available, that's to be preferred, but this is a good backup. - elif [[ $distro_file == 'lsb-release' ]];then - distro=$( get_distro_lsb_data ) + elif [[ $distro = '' ]];then + for j in $DISTROS_LSB_GOOD + do + if [[ " ${distro_file} " == *" $j "* ]];then + distro=$( get_distro_lsb_data ) + fi + done # then if the distro id file was found and it's not in the exluded primary distro file list, read it elif [[ -n $distro_file && -s /etc/$distro_file && " $DISTROS_EXCLUDE_LIST " != *" $distro_file "* ]];then distro=$( remove_erroneous_chars "/etc/$distro_file" ) @@ -1350,8 +1360,6 @@ get_distro_data() if [[ ${#distro} -gt 80 && $B_HANDLE_CORRUPT_DATA != 'true' ]];then distro="${RED}/etc/${distro_file} corrupted, use -% to override${NORMAL}" fi - ## note: would like to actually understand the method even if it's not used - # : ${distro:=Unknown distro o_O} ## test for /etc/lsb-release as a backup in case of failure, in cases where > one version/release file ## were found but the above resulted in null distro value if [[ -z $distro && -f /etc/lsb-release ]];then