Hopefully this fix won't break others, fixed lsb issues

This commit is contained in:
trash80.v2.0 2008-12-20 18:35:55 +00:00
parent 05ff262a50
commit ce39d68a7a

29
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.8.11.b2.5 #### version: 0.8.11.b2.7
#### Date: December 16 2008 #### Date: December 16 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
@ -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 mandrake-release 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"
DISTROS_LSB_GOOD="mandrake-release mandriva-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
@ -1294,7 +1295,7 @@ get_cpu_data()
## 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,6 +1318,17 @@ get_distro_data()
break break
fi fi
done done
# Now lets see if the distro file is in the known-good working-lsb-list
# if so, use lsb-release
# this is for only those distro's with self named release/version files
# because Mint does not use such, it must be done as below
for j in $DISTROS_LSB_GOOD
do
if [[ " ${distro_file} " == *" $j "* ]];then
distro_file='lsb-release'
break
fi
done
fi fi
# first test for the legacy antiX distro id file # first test for the legacy antiX distro id file
@ -1325,15 +1337,8 @@ get_distro_data()
# 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 = '' ]];then elif [[ $distro_file == 'lsb-release' ]];then
if [[ ($distro_file == 'lsb-release') || -f /etc/lsb-release ]];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
fi
# 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" )