add support for netbsd, freebsd, and haiku

This commit is contained in:
abbie 2024-11-12 16:54:35 +00:00
parent c93104da4d
commit ee4ef73670
Signed by: threeoh6000
GPG key ID: 801FE4AD456E922C
2 changed files with 59 additions and 29 deletions

View file

@ -4,11 +4,14 @@ abbiefetch is a POSIX compliant fetch script intended to be as portable as possi
## Compatibility ## Compatibility
abbiefetch will attempt to gather as much information as possible on systems that don't have full compatibility and will provide you with a system type (and sometimes a subtype) to let you know what abbiefetch thinks your computer is running. abbiefetch will attempt to gather as much information as possible on systems that don't have full compatibility and will provide you with a system type (and sometimes a subtype) to let you know what abbiefetch thinks your computer is running.
| Type string | Kernel | System | | Type string | System type | Subtype | Support since |
| - | - | - | | - | - | - |
| `unknown` | Unknown kernel | | | `unknown` | Unknown kernel | | |
| `linux` | Linux | | | `linux` | Linux | | 1.0.0 |
| `linux/chumby` | Linux | Chumby internet appliances | | `linux/chumby` | Linux | Chumby internet appliances | 1.0.0 |
| `linux/proxmox` | Linux | Proxmox VE host | | `linux/proxmox` | Linux | Proxmox VE host | 1.0.0 |
| `linux/rpi` | Linux | Raspberry Pi single board computer | | `linux/rpi` | Linux | Raspberry Pi single board computer | 1.0.0 |
| `openbsd` | OpenBSD | | | `openbsd` | OpenBSD | | 1.0.0 |
| `netbsd` | NetBSD | | 1.1.0 |
| `freebsd` | FreeBSD | | 1.1.0 |
| `haiku` | Haiku | | 1.1.0 |

View file

@ -35,27 +35,34 @@ if [ "$?" -eq 0 ]; then
hassed=1 hassed=1
fi fi
command -v chumby_version >>/dev/null
if [ "$?" -eq 0 ] && [ "$system_type" = "unknown" ]; then
system_type="linux"
subtype="chumby"
fi
command -v raspi-config >>/dev/null
if [ "$?" -eq 0 ] && [ "$system_type" = "unknown" ]; then
system_type="linux"
subtype="rpi"
fi
command -v pveversion >>/dev/null
if [ "$?" -eq 0 ] && [ "$system_type" = "unknown" ]; then
system_type="linux"
subtype="proxmox"
fi
if [ "$(uname -s)" = "Linux" ] && [ "$system_type" = "unknown" ]; then if [ "$(uname -s)" = "Linux" ] && [ "$system_type" = "unknown" ]; then
system_type="linux" system_type="linux"
command -v chumby_version >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="chumby"
fi
command -v raspi-config >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="rpi"
fi
command -v pveversion >>/dev/null
if [ "$?" -eq 0 ] && [ "$subtype" = "none" ]; then
subtype="proxmox"
fi
fi fi
if [ "$(uname -s)" = "OpenBSD" ] && [ "$system_type" = "unknown" ]; then if [ "$(uname -s)" = "OpenBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="openbsd" system_type="openbsd"
fi fi
if [ "$(uname -s)" = "FreeBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="freebsd"
fi
if [ "$(uname -s)" = "NetBSD" ] && [ "$system_type" = "unknown" ]; then
system_type="netbsd"
fi
if [ "$(uname -s)" = "Haiku" ] && [ "$system_type" = "unknown" ]; then
system_type="haiku"
fi
if [ "$hashostname" -eq 1 ]; then if [ "$hashostname" -eq 1 ]; then
hostname="$(hostname)" hostname="$(hostname)"
@ -70,7 +77,15 @@ fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "openbsd" ] && [ -z "$processor" ]; then if [ "$hasawk" -eq 1 ] && [ $system_type = "openbsd" ] && [ -z "$processor" ]; then
processor="$(sysctl hw.model | awk -F "=" '{print $2}')" processor="$(sysctl hw.model | awk -F "=" '{print $2}')"
fi fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "freebsd" ] && [ -z "$processor" ]; then
processor="$(sysctl hw.model | awk -F ": " '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "netbsd" ] && [ -z "$processor" ]; then
processor="$(sysctl machdep.cpu_brand | awk -F " = " '{print $2}')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "haiku" ] && [ -z "$processor" ]; then
processor="$(sysinfo | grep "CPU #0" | awk -F "\"" '{ print $2 }')"
fi
if [ "$hasawk" -eq 1 ] && [ $system_type = "linux" ] && [ -z "$processor" ]; then if [ "$hasawk" -eq 1 ] && [ $system_type = "linux" ] && [ -z "$processor" ]; then
if [ -n "$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')" ]; then if [ -n "$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')" ]; then
processor="$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')" processor="$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F ": " '{print $2}')"
@ -98,8 +113,8 @@ if [ -n "$(uname -s)" ] && [ -z "$kernel" ]; then
fi fi
if [ "$hasglxinfo" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then if [ "$hasglxinfo" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then
if [ -n "$(glxinfo | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')" ]; then if [ -n "$(glxinfo 2>/dev/null | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')" ]; then
graphics="$(glxinfo | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')" graphics="$(glxinfo 2>/dev/null | grep "OpenGL renderer string" | awk -F ": " '{print $2}' | awk -F "(" '{print $1}')"
fi fi
fi fi
if [ "$haslspci" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then if [ "$haslspci" -eq 1 ] && [ "$hasawk" -eq 1 ] && [ -z "$graphics" ]; then
@ -126,7 +141,6 @@ if [ -f /etc/os-release ] && [ $system_type = "linux" ]; then
fi fi
fi fi
fi fi
if [ $subtype = "chumby" ]; then if [ $subtype = "chumby" ]; then
distro="Chumby firmware $(chumby_version -s)" distro="Chumby firmware $(chumby_version -s)"
if [ "$hasawk" -eq 1 ]; then if [ "$hasawk" -eq 1 ]; then
@ -141,7 +155,6 @@ if [ $subtype = "chumby" ]; then
fi fi
fi fi
fi fi
if [ $subtype = "proxmox" ]; then if [ $subtype = "proxmox" ]; then
if [ "$hasawk" -eq 1 ]; then if [ "$hasawk" -eq 1 ]; then
if [ -n "$(pveversion | awk -F "/" '{ print $2 }')" ]; then if [ -n "$(pveversion | awk -F "/" '{ print $2 }')" ]; then
@ -149,13 +162,27 @@ if [ $subtype = "proxmox" ]; then
fi fi
fi fi
fi fi
if [ $system_type = "openbsd" ]; then if [ $system_type = "openbsd" ]; then
if [ "$hasawk" -eq 1 ]; then if [ "$hasawk" -eq 1 ]; then
distro="$(sysctl kern.osrevision | awk -F "=" '{print $2}')" distro="revision $(sysctl kern.osrevision | awk -F "=" '{print $2}')"
machine="$(sysctl hw.vendor | awk -F "=" '{print $2}') $(sysctl hw.product | awk -F "=" '{print $2}')" machine="$(sysctl hw.vendor | awk -F "=" '{print $2}') $(sysctl hw.product | awk -F "=" '{print $2}')"
fi fi
fi fi
if [ $system_type = "freebsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F ": " '{print $2}')"
fi
machine="$(kenv smbios.system.maker) $(kenv smbios.system.product)"
fi
if [ $system_type = "netbsd" ]; then
if [ "$hasawk" -eq 1 ]; then
distro="revision $(sysctl kern.osrevision | awk -F " = " '{print $2}')"
machine="$(sysctl machdep.dmi.system-vendor | awk -F " = " '{print $2}') $(sysctl machdep.dmi.system-product | awk -F " = " '{print $2}')"
fi
fi
if [ $system_type = "haiku" ]; then
distro="$(uname -v)"
fi
if [ $system_type = "linux" ] && [ -z "$machine" ]; then if [ $system_type = "linux" ] && [ -z "$machine" ]; then
if [ -f "/sys/devices/virtual/dmi/id/product_name" ]; then if [ -f "/sys/devices/virtual/dmi/id/product_name" ]; then