OS: Added initial support for MINIX
This commit is contained in:
parent
9496c542eb
commit
c3d60901d9
34
neofetch
34
neofetch
|
@ -38,6 +38,7 @@ get_os() {
|
||||||
"CYGWIN"*) os="Windows" ;;
|
"CYGWIN"*) os="Windows" ;;
|
||||||
"SunOS") os="Solaris" ;;
|
"SunOS") os="Solaris" ;;
|
||||||
"Haiku") os="Haiku" ;;
|
"Haiku") os="Haiku" ;;
|
||||||
|
"MINIX") os="MINIX" ;;
|
||||||
*) printf "%s\n" "Unknown OS detected: $kernel_name"; exit 1 ;;
|
*) printf "%s\n" "Unknown OS detected: $kernel_name"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -146,7 +147,7 @@ get_distro() {
|
||||||
os_arch="off"
|
os_arch="off"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"BSD")
|
"BSD" | "MINIX")
|
||||||
case "$distro_shorthand" in
|
case "$distro_shorthand" in
|
||||||
"tiny" | "on") distro="$kernel_name" ;;
|
"tiny" | "on") distro="$kernel_name" ;;
|
||||||
*) distro="$kernel_name $kernel_version" ;;
|
*) distro="$kernel_name $kernel_version" ;;
|
||||||
|
@ -250,7 +251,7 @@ get_model() {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"BSD")
|
"BSD" | "MINIX")
|
||||||
model="$(sysctl -n hw.vendor hw.product)"
|
model="$(sysctl -n hw.vendor hw.product)"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -284,6 +285,8 @@ get_title() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_kernel() {
|
get_kernel() {
|
||||||
|
[[ "$os" == "MINIX" ]] && local os="BSD"
|
||||||
|
|
||||||
case "$kernel_shorthand" in
|
case "$kernel_shorthand" in
|
||||||
"on") kernel="$kernel_version" ;;
|
"on") kernel="$kernel_version" ;;
|
||||||
"off") kernel="$kernel_name $kernel_version" ;;
|
"off") kernel="$kernel_name $kernel_version" ;;
|
||||||
|
@ -310,7 +313,7 @@ get_uptime() {
|
||||||
*)
|
*)
|
||||||
# Get uptime in seconds
|
# Get uptime in seconds
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux" | "Windows")
|
"Linux" | "Windows" | "MINIX")
|
||||||
seconds="$(< /proc/uptime)"
|
seconds="$(< /proc/uptime)"
|
||||||
seconds="${seconds/.*}"
|
seconds="${seconds/.*}"
|
||||||
;;
|
;;
|
||||||
|
@ -441,7 +444,7 @@ get_packages() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X" | "MINIX")
|
||||||
[[ -d "/usr/local/bin" ]] && \
|
[[ -d "/usr/local/bin" ]] && \
|
||||||
packages="$(($(ls -l /usr/local/bin/ | grep -cv "\(../Cellar/\|brew\)") - 1))"
|
packages="$(($(ls -l /usr/local/bin/ | grep -cv "\(../Cellar/\|brew\)") - 1))"
|
||||||
|
|
||||||
|
@ -713,7 +716,7 @@ get_cpu() {
|
||||||
# NetBSD emulates the linux /proc filesystem instead of using sysctl for hw
|
# NetBSD emulates the linux /proc filesystem instead of using sysctl for hw
|
||||||
# information so we have to use this block below which temporarily sets the
|
# information so we have to use this block below which temporarily sets the
|
||||||
# OS to 'Linux' for the duration of this function.
|
# OS to 'Linux' for the duration of this function.
|
||||||
[[ "$distro" == "NetBSD"* ]] && local os="Linux"
|
[[ "$distro" == "NetBSD"* || "$os" == "MINIX" ]] && local os="Linux"
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux" | "Windows")
|
"Linux" | "Windows")
|
||||||
|
@ -929,7 +932,7 @@ get_cpu_usage() {
|
||||||
# Get cores if unset
|
# Get cores if unset
|
||||||
if [[ "$cpu_cores" == "off" ]]; then
|
if [[ "$cpu_cores" == "off" ]]; then
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
|
"Linux" | "MINIX") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
|
||||||
"Mac OS X") cores="$(sysctl -n hw.logicalcpu_max)" ;;
|
"Mac OS X") cores="$(sysctl -n hw.logicalcpu_max)" ;;
|
||||||
"BSD") cores="$(sysctl -n hw.ncpu)" ;;
|
"BSD") cores="$(sysctl -n hw.ncpu)" ;;
|
||||||
"Solaris") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
|
"Solaris") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
|
||||||
|
@ -1031,7 +1034,7 @@ get_gpu() {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"BSD" | "Solaris")
|
"BSD" | "Solaris" | "MINIX")
|
||||||
case "$kernel_name" in
|
case "$kernel_name" in
|
||||||
"FreeBSD"* | "DragonFly"*)
|
"FreeBSD"* | "DragonFly"*)
|
||||||
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
|
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
|
||||||
|
@ -1088,7 +1091,7 @@ get_memory() {
|
||||||
mem_used="$(((${mem_wired//.} + ${mem_active//.} + ${mem_compressed//.}) * 4 / 1024))"
|
mem_used="$(((${mem_wired//.} + ${mem_active//.} + ${mem_compressed//.}) * 4 / 1024))"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"BSD")
|
"BSD" | "MINIX")
|
||||||
# Mem total
|
# Mem total
|
||||||
case "$kernel_name" in
|
case "$kernel_name" in
|
||||||
"NetBSD"*) mem_total="$(($(sysctl -n hw.physmem64) / 1024 / 1024))" ;;
|
"NetBSD"*) mem_total="$(($(sysctl -n hw.physmem64) / 1024 / 1024))" ;;
|
||||||
|
@ -1102,7 +1105,10 @@ get_memory() {
|
||||||
mem_free="$(top -d 1 | awk -F ',' '/^Mem:/ {print $5}')"
|
mem_free="$(top -d 1 | awk -F ',' '/^Mem:/ {print $5}')"
|
||||||
mem_free="${mem_free/M Free}"
|
mem_free="${mem_free/M Free}"
|
||||||
;;
|
;;
|
||||||
|
"MINIX")
|
||||||
|
mem_free="$(top -d 1 | awk -F ',' '/^Memory:/ {print $2}')"
|
||||||
|
mem_free="${mem_free/M Free}"
|
||||||
|
;;
|
||||||
"OpenBSD"*) ;;
|
"OpenBSD"*) ;;
|
||||||
*) mem_free="$(($(vmstat | awk 'END{printf $5}') / 1024))" ;;
|
*) mem_free="$(($(vmstat | awk 'END{printf $5}') / 1024))" ;;
|
||||||
esac
|
esac
|
||||||
|
@ -1218,7 +1224,7 @@ get_song() {
|
||||||
|
|
||||||
get_resolution() {
|
get_resolution() {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux" | "BSD" | "Solaris")
|
"Linux" | "BSD" | "Solaris" | "MINIX")
|
||||||
if type -p xrandr >/dev/null; then
|
if type -p xrandr >/dev/null; then
|
||||||
case "$refresh_rate" in
|
case "$refresh_rate" in
|
||||||
"on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;;
|
"on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;;
|
||||||
|
@ -1637,7 +1643,7 @@ get_battery() {
|
||||||
|
|
||||||
get_local_ip() {
|
get_local_ip() {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux" | "BSD" | "Solaris")
|
"Linux" | "BSD" | "Solaris" | "MINIX")
|
||||||
local_ip="$(ip route get 1 | awk '{print $NF;exit}')"
|
local_ip="$(ip route get 1 | awk '{print $NF;exit}')"
|
||||||
[[ -z "$local_ip" ]] && local_ip="$(ifconfig | awk '/broadcast/ {print $2}')"
|
[[ -z "$local_ip" ]] && local_ip="$(ifconfig | awk '/broadcast/ {print $2}')"
|
||||||
;;
|
;;
|
||||||
|
@ -1689,9 +1695,9 @@ get_install_date() {
|
||||||
install_date="$(ls -lUT /var/log/install.log | awk '{printf $9 " " $6 " " $7 " " $8}')"
|
install_date="$(ls -lUT /var/log/install.log | awk '{printf $9 " " $6 " " $7 " " $8}')"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"BSD")
|
"BSD" | "MINIX")
|
||||||
case "$kernel_name" in
|
case "$kernel_name" in
|
||||||
"OpenBSD"* | "Bitrig"*)
|
"OpenBSD"* | "Bitrig"* | "MINIX")
|
||||||
install_file="/"
|
install_file="/"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1926,7 +1932,7 @@ get_w3m_img_path() {
|
||||||
|
|
||||||
get_wallpaper() {
|
get_wallpaper() {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux" | "BSD" | "Solaris")
|
"Linux" | "BSD" | "Solaris" | "MINIX")
|
||||||
# Get DE if user has disabled the function.
|
# Get DE if user has disabled the function.
|
||||||
(( "$de_run" != 1 )) && get_de
|
(( "$de_run" != 1 )) && get_de
|
||||||
|
|
||||||
|
|
Reference in New Issue