New version, new tarball. Tiny fix in distro detection, will now default in sequence

on /etc/issue step to first test for os release and not mint, then lsb verison and
not mint, then /etc/issue. This should keep the mint detection working well, as long
as they keep mint string in the /etc/issue file, that is, but that's out of our control.
This commit is contained in:
Harald Hope 2016-03-30 13:32:04 -07:00
parent 002ce22cb6
commit 24b096a48e
2 changed files with 42 additions and 12 deletions

39
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### Version: 2.2.36 #### Version: 2.2.37
#### Date: 2016-03-21 #### Date: 2016-03-30
#### Patch Number: 00 #### Patch Number: 00
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
@ -710,7 +710,7 @@ main()
# note: this only works if it's run from inside konversation as a script builtin or something # note: this only works if it's run from inside konversation as a script builtin or something
# only do this if inxi has been started as a konversation script, otherwise bypass this # only do this if inxi has been started as a konversation script, otherwise bypass this
# KONVI=3 ## for testing puroses # KONVI=3 ## for testing puroses
if [[ $KONVI -eq 1 || $KONVI -eq 3 ]];then if [[ $KONVI -eq 1 || $KONVI -eq 3 ]];then
if [[ $KONVI -eq 1 ]]; then ## dcop Konversation (ie 1.x < 1.2(qt3)) if [[ $KONVI -eq 1 ]]; then ## dcop Konversation (ie 1.x < 1.2(qt3))
DCPORT="$1" DCPORT="$1"
@ -1758,7 +1758,10 @@ debug_data_collector()
get_repo_data "$SCRIPT_DATA_DIR/$debug_data_dir" get_repo_data "$SCRIPT_DATA_DIR/$debug_data_dir"
if type -p shopt &>/dev/null;then if type -p shopt &>/dev/null;then
shopt -s nullglob;a_distro_ids=(/etc/*[-_]{release,version});shopt -u nullglob;echo ${a_distro_ids[@]} &> $debug_data_dir/etc-distro-files.txt shopt -s nullglob
a_distro_ids=(/etc/*[-_]{release,version})
shopt -u nullglob
echo ${a_distro_ids[@]} &> $debug_data_dir/etc-distro-files.txt
for distro_file in ${a_distro_ids[@]} /etc/issue for distro_file in ${a_distro_ids[@]} /etc/issue
do do
if [[ -f $distro_file ]];then if [[ -f $distro_file ]];then
@ -5101,7 +5104,7 @@ get_display_manager()
get_distro_data() get_distro_data()
{ {
eval $LOGFS eval $LOGFS
local i='' j='' distro='' distro_file='' a_distro_glob='' a_temp='' local i='' j='' distro='' distro_file='' a_distro_glob='' a_temp='' b_osr='false'
# may need modification if archbsd / debian can be id'ed with /etc files # may need modification if archbsd / debian can be id'ed with /etc files
if [[ -n $BSD_TYPE ]];then if [[ -n $BSD_TYPE ]];then
@ -5174,6 +5177,7 @@ get_distro_data()
distro=$( get_distro_lsb_os_release_data 'lsb-file' ) distro=$( get_distro_lsb_os_release_data 'lsb-file' )
elif [[ $distro_file == 'os-release' ]];then elif [[ $distro_file == 'os-release' ]];then
distro=$( get_distro_lsb_os_release_data 'os-release-file' ) distro=$( get_distro_lsb_os_release_data 'os-release-file' )
b_osr='true'
# 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
# new opensuse uses os-release, but older ones may have a similar syntax, so just use the first line # new opensuse uses os-release, but older ones may have a similar syntax, so just use the first line
@ -5187,9 +5191,12 @@ get_distro_data()
fi fi
# otherwise try the default debian/ubuntu /etc/issue file # otherwise try the default debian/ubuntu /etc/issue file
elif [[ -f /etc/issue ]];then elif [[ -f /etc/issue ]];then
# lsb gives more manageable and accurate output than issue, but mint should use issue for now # os-release/lsb gives more manageable and accurate output than issue, but mint should use issue for now
# some bashism, boolean must be in parenthesis to work correctly, ie [[ $(boolean) ]] not [[ $boolean ]] # some bashism, boolean must be in parenthesis to work correctly, ie [[ $(boolean) ]] not [[ $boolean ]]
if [[ $B_LSB_FILE == 'true' ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then if [[ $B_OS_RELEASE_FILE == 'true' ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then
distro=$( get_distro_lsb_os_release_data 'os-release-file' )
b_osr='true'
elif [[ $B_LSB_FILE == 'true' ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then
distro=$( get_distro_lsb_os_release_data 'lsb-file' ) distro=$( get_distro_lsb_os_release_data 'lsb-file' )
else else
distro=$( gawk ' distro=$( gawk '
@ -5212,20 +5219,28 @@ get_distro_data()
fi fi
fi fi
fi fi
# a final check. If a long value, before assigning the debugger output, if os-release
# exists then let's use that if it wasn't tried already. Maybe that will be better.
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}" if [[ $B_OS_RELEASE_FILE == 'true' && $b_osr == 'false' ]];then
distro=$( get_distro_lsb_os_release_data 'os-release-file' )
fi
if [[ ${#distro} -gt 80 ]];then
distro="${RED}/etc/$distro_file corrupted, use -% to override${NORMAL}"
fi
fi fi
## note: would like to actually understand the method even if it's not used ## note: would like to actually understand the method even if it's not used
# : ${distro:=Unknown distro o_O} # : ${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 ]] && [[ $B_LSB_FILE == 'true' ]];then # Because os-release is now more common, we'll test for it first.
distro=$( get_distro_lsb_os_release_data 'lsb-file' )
fi
if [[ -z $distro ]] && [[ $B_OS_RELEASE_FILE == 'true' ]];then if [[ -z $distro ]] && [[ $B_OS_RELEASE_FILE == 'true' ]];then
distro=$( get_distro_lsb_os_release_data 'os-release-file' ) distro=$( get_distro_lsb_os_release_data 'os-release-file' )
fi fi
if [[ -z $distro ]] && [[ $B_LSB_FILE == 'true' ]];then
distro=$( get_distro_lsb_os_release_data 'lsb-file' )
fi
# now some final null tries # now some final null tries
if [[ -z $distro ]];then if [[ -z $distro ]];then
# if the file was null but present, which can happen in some cases, then use the file name itself to # if the file was null but present, which can happen in some cases, then use the file name itself to

View file

@ -1,3 +1,18 @@
=====================================================================================
Version: 2.2.37
Patch Version: 00
Script Date: 2016-03-30
-----------------------------------
Changes:
-----------------------------------
New version, new tarball. Tiny fix in distro detection, will now default in sequence
on /etc/issue step to first test for os release and not mint, then lsb verison and
not mint, then /etc/issue. This should keep the mint detection working well, as long
as they keep mint string in the /etc/issue file, that is, but that's out of our control.
-----------------------------------
-- Harald Hope - Wed, 30 Mar 2016 13:28:40 -0700
===================================================================================== =====================================================================================
Version: 2.2.36 Version: 2.2.36
Patch Version: 00 Patch Version: 00