bsd fixes

This commit is contained in:
inxi-svn 2014-05-01 23:18:53 +00:00
parent 68eeb6a28c
commit b7488ca5e6

26
inxi
View file

@ -796,15 +796,17 @@ initialize_data()
BSD_VERSION=$( uname -s 2>/dev/null | tr '[A-Z]' '[a-z]' )
# note: archbsd says they are a freebsd distro, so assuming it's the same as freebsd
if [[ -z ${BSD_VERSION/*bsd*/} || -z ${BSD_VERSION/*darwin*/} ]];then
if [[ -z ${BSD_VERSION/*openbsd*/} ]];then
BSD_VERSION='openbsd'
fi
if [[ -z ${BSD_VERSION/*darwin*/} ]];then
BSD_VERSION='darwin'
fi
# GNU/kfreebsd will by definition have GNU tools like sed/grep
if [[ -z ${BSD_VERSION/*kfreebsd*/} ]];then
BSD_TYPE='debian-bsd' # debian gnu bsd
else
if [[ -z ${BSD_VERSION/*darwin*/} ]];then
BSD_TYPE='darwin-bsd' # debian gnu bsd
else
BSD_TYPE='bsd' # all other bsds
fi
SED_I="-i ''"
SED_RX='-E'
ESC=$(echo | tr '\n' '\033')
@ -1049,7 +1051,7 @@ check_required_apps()
if [[ -z $BSD_TYPE ]];then
depends="$depends lspci"
elif [[ $BSD_TYPE == 'bsd' || $BSD_TYPE == 'darwin-bsd' ]];then
elif [[ $BSD_TYPE == 'bsd' ]];then
depends="$depends sysctl"
# debian-bsd has lspci but you must be root to run it
elif [[ $BSD_TYPE == 'debian-bsd' ]];then
@ -3649,7 +3651,7 @@ get_cpu_core_count()
if [[ $BSD_VERSION == 'openbsd' ]];then
gawk_fs='='
fi
cpu_core_count=$( gawk -F "$gawk_fs" -v bsdType=$BSD_TYPE '
cpu_core_count=$( gawk -F "$gawk_fs" -v bsdType=$BSD_VERSION '
# note: on openbsd can also be hw.ncpufound so exit after first
BEGIN {
coreCount=""
@ -3871,7 +3873,7 @@ get_cpu_data_bsd()
local gawk_fs=': '
# note, in darwin, they switch fs from = to : ... sigh
if [[ $BSD_VERSION == 'openbsd' || $BSD_TYPE == 'darwin-bsd' ]];then
if [[ $BSD_VERSION == 'openbsd' || $BSD_VERSION == 'darwin' ]];then
gawk_fs='='
fi
# avoid setting this for systems where you have no read/execute permissions
@ -3879,7 +3881,7 @@ get_cpu_data_bsd()
if [[ -n $Sysctl_a_Data || -n $bsd_cpu_flags ]];then
IFS=$'\n'
A_CPU_DATA=( $(
gawk -F "$gawk_fs" -v bsdType=$BSD_TYPE -v cpuFlags="$bsd_cpu_flags" '
gawk -F "$gawk_fs" -v bsdVersion=$BSD_VERSION -v cpuFlags="$bsd_cpu_flags" '
BEGIN {
IGNORECASE=1
cpuModel=""
@ -3889,7 +3891,7 @@ get_cpu_data_bsd()
cpuVendor=""
bMach="false"
}
( bsdType != "darwin-bsd" ) && /^hw.model/ {
( bsdVersion != "darwin" ) && /^hw.model/ {
gsub(/'"$BAN_LIST_NORMAL"'/, "", $NF )
gsub(/'"$BAN_LIST_CPU"'/, "", $NF )
sub(//,"",$NF)
@ -4572,7 +4574,7 @@ get_distro_data()
# may need modification if archbsd / debian can be id'ed with /etc files
if [[ -n $BSD_TYPE ]];then
if [[ $BSD_TYPE != 'darwin-bsd' ]];then
if [[ $BSD_VERSION != 'darwin' ]];then
distro=$( uname -sr )
else
if [[ -f /System/Library/CoreServices/SystemVersion.plist ]];then
@ -5960,7 +5962,7 @@ get_kernel_compiler_version()
compiler_type='gcc'
fi
else
if [[ $BSD_TYPE == 'darwin-bsd' ]];then
if [[ $BSD_VERSION == 'darwin' ]];then
if type -p gcc &>/dev/null;then
compiler_version=$( get_program_version 'gcc' 'Apple[[:space:]]LLVM' '4' )
if [[ -n $compiler_version ]];then
@ -7103,7 +7105,7 @@ get_partition_data()
dev_item=${a_partition_working[6]} # reset each loop
fs_type=${a_partition_working[5]}
# older bsds have df minus -T so can't get fs type easily, try using mount instead
if [[ $BSD_TYPE == 'bsd' && -z $fs_type && -n $dev_item ]];then
if [[ $BSD_TYPE == 'bsd' ]] && [[ -z $fs_type && -n $dev_item ]];then
dev_bsd_item=$( sed -e 's/non-dev-//' -e 's|/|\\/|g' <<< "$dev_item" )
fs_type=$( gawk -F '(' '
/'$dev_bsd_item'/ {