added known good lsb distros

This commit is contained in:
trash80.v2.0 2008-12-20 06:17:06 +00:00
parent aef42dccf7
commit 44d8e069dc

22
inxi Executable file → Normal file
View file

@ -227,10 +227,11 @@ CN=''
### Distro Data ### Distro Data
# In cases of derived distros where the version file of the base distro can also be found under /etc, # 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) # 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. # 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_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 ### Bans Data
# Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_ban_lists routine # 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 # 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 ## return distro name/id if found
get_distro_data() 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 # get the wild carded array of release/version /etc files if present
shopt -s nullglob shopt -s nullglob
@ -1317,16 +1320,23 @@ get_distro_data()
break break
fi fi
done done
fi ## now check for the known good lsb-release distro's
fi
#########################################################################################################################################
# first test for the legacy antiX distro id file # first test for the legacy antiX distro id file
if [[ -e /etc/antiX ]];then if [[ -e /etc/antiX ]];then
distro="$( egrep -oi 'antix.*\.iso' <<< $( remove_erroneous_chars '/etc/antiX' ) | sed 's/\.iso//' )" 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 # 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 # 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. # 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 elif [[ $distro = '' ]];then
for j in $DISTROS_LSB_GOOD
do
if [[ " ${distro_file} " == *" $j "* ]];then
distro=$( get_distro_lsb_data ) 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 # 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 elif [[ -n $distro_file && -s /etc/$distro_file && " $DISTROS_EXCLUDE_LIST " != *" $distro_file "* ]];then
distro=$( remove_erroneous_chars "/etc/$distro_file" ) distro=$( remove_erroneous_chars "/etc/$distro_file" )
@ -1350,8 +1360,6 @@ get_distro_data()
if [[ ${#distro} -gt 80 && $B_HANDLE_CORRUPT_DATA != 'true' ]];then if [[ ${#distro} -gt 80 && $B_HANDLE_CORRUPT_DATA != 'true' ]];then
distro="${RED}/etc/${distro_file} corrupted, use -% to override${NORMAL}" distro="${RED}/etc/${distro_file} corrupted, use -% to override${NORMAL}"
fi 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 ## 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 ## were found but the above resulted in null distro value
if [[ -z $distro && -f /etc/lsb-release ]];then if [[ -z $distro && -f /etc/lsb-release ]];then