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
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.3.6
|
#### version: 0.3.7
|
||||||
#### Date: November 2 2008
|
#### Date: November 2 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||||
|
@ -151,10 +151,10 @@ 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 kanotix-version knoppix-version redhat-release sabayon-release sidux-version turbolinux-release zenwalk-version"
|
DISTROS_DERIVED="antix-version 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"
|
|
||||||
# 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_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
|
### 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
|
||||||
|
@ -904,21 +904,23 @@ get_distro_data()
|
||||||
cd "$OLDPWD"
|
cd "$OLDPWD"
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
|
|
||||||
if (( ${#a_distro_glob[@]} == 1 ));then
|
if [ "${#a_distro_glob[@]}" -eq 1 ];then
|
||||||
distro_file="${a_distro_glob}"
|
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
|
for i in $DISTROS_DERIVED $DISTROS_PRIMARY
|
||||||
do
|
do
|
||||||
# Only echo works with ${var[@]}, not print_screen_output() or script_debugger()
|
# Only echo works with ${var[@]}, not print_screen_output() or script_debugger()
|
||||||
# This is a known bug, search for the word "strange" inside comments
|
# This is a known bug, search for the word "strange" inside comments
|
||||||
# echo "i='$i' a_distro_glob[@]='${a_distro_glob[@]}'"
|
# 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
|
if [[ " ${a_distro_glob[@]} " == *" $i "* ]];then
|
||||||
distro_file="${i}"
|
distro_file="${i}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
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" )
|
distro=$( remove_erroneous_chars "/etc/$distro_file" )
|
||||||
# this is necessary because antiX doesn't use version/release in its distro id file name
|
# 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
|
# 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}
|
: ${distro:=Unknown distro o_O}
|
||||||
|
|
||||||
# this handles an arch bug where /etc/arch-release is empty and /etc/issue is corrupted
|
# this handles an arch bug where /etc/arch-release is empty and /etc/issue is corrupted
|
||||||
if [ -n "$( grep -i 'arch linux' <<< $distro )" ]
|
if [ -n "$( grep -i 'arch linux' <<< $distro )" ];then
|
||||||
then
|
|
||||||
distro='Arch Linux'
|
distro='Arch Linux'
|
||||||
fi
|
fi
|
||||||
echo "$distro"
|
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]}" )
|
A_GFX_CARD_DATA[i]=$( sanitize_characters A_NORMAL_BANS "${A_GFX_CARD_DATA[i]}" )
|
||||||
done
|
done
|
||||||
# handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes..
|
# 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!'
|
A_GFX_CARD_DATA[0]='Failed to Detect Video Card!'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1230,11 +1231,15 @@ get_networking_data()
|
||||||
for (i in eth) {
|
for (i in eth) {
|
||||||
if (eth[i]>1) {
|
if (eth[i]>1) {
|
||||||
a[j]=eth[i]"x "i
|
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 {
|
else {
|
||||||
a[j]=i
|
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++
|
j++
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue