mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
Added proper antix-version handling to get distro name
This commit is contained in:
parent
3dadd268e3
commit
11b4075dbf
29
inxi
29
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.3.6
|
||||
#### version: 0.3.7
|
||||
#### Date: November 2 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||
|
@ -151,10 +151,10 @@ 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 kanotix-version knoppix-version redhat-release sabayon-release sidux-version turbolinux-release zenwalk-version"
|
||||
DISTROS_PRIMARY="gentoo-release mandrake-release redhat-release slackware-version SuSE-release"
|
||||
DISTROS_DERIVED="antix-version kanotix-version knoppix-version redhat-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.
|
||||
DISTROS_BLIST="debian_version ubuntu_version"
|
||||
DISTROS_EXCLUDE_LIST="debian_version ubuntu_version"
|
||||
DISTROS_PRIMARY="gentoo-release mandrake-release redhat-release slackware-version SuSE-release"
|
||||
|
||||
### Bans Data
|
||||
# Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_ban_lists routine
|
||||
|
@ -904,21 +904,23 @@ get_distro_data()
|
|||
cd "$OLDPWD"
|
||||
shopt -u nullglob
|
||||
|
||||
if (( ${#a_distro_glob[@]} == 1 ));then
|
||||
if [ "${#a_distro_glob[@]}" -eq 1 ];then
|
||||
distro_file="${a_distro_glob}"
|
||||
elif (( ${#a_distro_glob[@]} > 1 ));then
|
||||
elif [ "${#a_distro_glob[@]}" -gt 1 ];then
|
||||
for i in $DISTROS_DERIVED $DISTROS_PRIMARY
|
||||
do
|
||||
# Only echo works with ${var[@]}, not print_screen_output() or script_debugger()
|
||||
# This is a known bug, search for the word "strange" inside comments
|
||||
# echo "i='$i' a_distro_glob[@]='${a_distro_glob[@]}'"
|
||||
## note: this method only works with [[ brackets, not [. It's very hard to actually
|
||||
## use this, it should probably be made more explicit.
|
||||
if [[ " ${a_distro_glob[@]} " == *" $i "* ]];then
|
||||
distro_file="${i}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ -n "$distro_file" -a -s /etc/$distro_file -a " $DISTROS_BLIST " != *" $distro_file "* ];then
|
||||
if [ -n "$distro_file" -a -s /etc/$distro_file -a " $DISTROS_EXCLUDE_LIST " != *" $distro_file "* ];then
|
||||
distro=$( remove_erroneous_chars "/etc/$distro_file" )
|
||||
# this is necessary because antiX doesn't use version/release in its distro id file name
|
||||
# so the glob tests fail. I expect those tests will need to be redone at some point to avoid this
|
||||
|
@ -939,8 +941,7 @@ get_distro_data()
|
|||
: ${distro:=Unknown distro o_O}
|
||||
|
||||
# this handles an arch bug where /etc/arch-release is empty and /etc/issue is corrupted
|
||||
if [ -n "$( grep -i 'arch linux' <<< $distro )" ]
|
||||
then
|
||||
if [ -n "$( grep -i 'arch linux' <<< $distro )" ];then
|
||||
distro='Arch Linux'
|
||||
fi
|
||||
echo "$distro"
|
||||
|
@ -959,7 +960,7 @@ get_graphics_card_data()
|
|||
A_GFX_CARD_DATA[i]=$( sanitize_characters A_NORMAL_BANS "${A_GFX_CARD_DATA[i]}" )
|
||||
done
|
||||
# handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes..
|
||||
if [[ ${#A_GFX_CARD_DATA[@]} -eq 0 ]];then
|
||||
if [ "${#A_GFX_CARD_DATA[@]}" -eq 0 ];then
|
||||
A_GFX_CARD_DATA[0]='Failed to Detect Video Card!'
|
||||
fi
|
||||
|
||||
|
@ -1230,11 +1231,15 @@ get_networking_data()
|
|||
for (i in eth) {
|
||||
if (eth[i]>1) {
|
||||
a[j]=eth[i]"x "i
|
||||
if (ports[i] != "") a[j]=a[j] ENVIRON["C1"]" Port:"ENVIRON["C2"] ports[i]
|
||||
if (ports[i] != "") a[j]=a[j] " - At Port:" ports[i]
|
||||
}
|
||||
else {
|
||||
a[j]=i
|
||||
if (ports[i] != "") a[j]=a[j] ENVIRON["C1"]" Port:"ENVIRON["C2"] ports[i];
|
||||
## note, some glitch in awk makes the second port number cut off if ENVIRON["C2"] is used
|
||||
## if (ports[i] != "") a[j]=a[j] ENVIRON["C1"] " At Port:" ENVIRON["C2"] ports[i]
|
||||
if (ports[i] != "") {
|
||||
a[j]=a[j] " - At Port:" ports[i]
|
||||
}
|
||||
}
|
||||
j++
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue