mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
new version 1.8.22, fixed an old bug with opensuse/suse detection, now sets to default to os-release parser, and a corrected basic
fallback for only /etc/SuSE-release present, presents only first line of that file. Also improved the /etc/os-release handler to include more data if the PRETTY_NAME field is blank. New tarball as well.
This commit is contained in:
parent
2c5b161c2f
commit
bbf0f29ca3
33
inxi
33
inxi
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.8.21
|
||||
#### version: 1.8.22
|
||||
#### Date: November 17 2012
|
||||
#### Patch Number: 01
|
||||
#### Patch Number: 00
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
########################################################################
|
||||
|
@ -3649,7 +3649,15 @@ get_distro_data()
|
|||
distro=$( get_lsb_os_release_data 'os-release-file' )
|
||||
# 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" )
|
||||
# new opensuse uses os-release, but older ones may have a similar syntax, so just use the first line
|
||||
if [[ $distro_file == 'SuSE-release' ]];then
|
||||
# leaving off extra data since all new suse have it, in os-release, this file has line breaks, like os-release
|
||||
# but in case we want it, it's: CODENAME = Mantis | VERSION = 12.2
|
||||
# for now, just take first occurance, which should be the first line, which does not use a variable type format
|
||||
distro=$( grep -i -m 1 'suse' /etc/$distro_file )
|
||||
else
|
||||
distro=$( remove_erroneous_chars "/etc/$distro_file" )
|
||||
fi
|
||||
# otherwise try the default debian/ubuntu /etc/issue file
|
||||
elif [[ -f /etc/issue ]];then
|
||||
# lsb gives more manageable and accurate output than issue, but mint should use issue for now
|
||||
|
@ -3800,6 +3808,8 @@ get_lsb_os_release_data()
|
|||
IGNORECASE=1
|
||||
prettyName=""
|
||||
regularName=""
|
||||
versionName=""
|
||||
versionId=""
|
||||
distroName=""
|
||||
}
|
||||
# note: adding the spacing directly to variable to make sure distro output is null if not found
|
||||
|
@ -3814,6 +3824,16 @@ get_lsb_os_release_data()
|
|||
if ( $NF != "n/a" ) {
|
||||
regularName = $NF
|
||||
}
|
||||
/^VERSION/ {
|
||||
gsub(/^ +| +$|\"/, "", $NF)
|
||||
gsub(/^ +| +$/, "", $1)
|
||||
if ( $NF != "n/a" && $1 == "VERSION") {
|
||||
versionName = $NF
|
||||
}
|
||||
else if ( $NF != "n/a" && $1 == "VERSION_ID") {
|
||||
versionId = $NF
|
||||
}
|
||||
}
|
||||
}
|
||||
END {
|
||||
if ( prettyName != "" ){
|
||||
|
@ -3821,6 +3841,13 @@ get_lsb_os_release_data()
|
|||
}
|
||||
else if ( regularName != "" ){
|
||||
distroName = regularName
|
||||
if ( versionName != "" ){
|
||||
distroName = distroName " " versionName
|
||||
}
|
||||
else if ( versionId != "" ){
|
||||
distroName = distroName " " versionId
|
||||
}
|
||||
|
||||
}
|
||||
print distroName
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue