initial minux support

This commit is contained in:
Dylan Araps 2019-09-28 13:11:49 +03:00
parent 090fe64dec
commit c9c27ba54b

19
pfetch
View File

@ -250,7 +250,7 @@ get_kernel() {
case $os in case $os in
# Don't print kernel output on some systems as the # Don't print kernel output on some systems as the
# OS name includes it. # OS name includes it.
*BSD*|Haiku) ;; *BSD*|Haiku|Minix) ;;
*) *)
# '$kernel' is the cached output of 'uname -r'. # '$kernel' is the cached output of 'uname -r'.
@ -337,7 +337,7 @@ get_uptime() {
# converting that data into days, hours and minutes using simple # converting that data into days, hours and minutes using simple
# math. # math.
case $os in case $os in
Linux*) Linux*|Minix*)
IFS=. read -r s _ < /proc/uptime IFS=. read -r s _ < /proc/uptime
;; ;;
@ -444,6 +444,10 @@ get_pkgs() {
Haiku) Haiku)
printf '%s\n' /boot/system/package-links/* printf '%s\n' /boot/system/package-links/*
;; ;;
Minix)
printf '%s\n' /usr/pkg/var/db/pkg/*/
;;
esac | wc -l esac | wc -l
` `
@ -589,6 +593,17 @@ get_memory() {
mem_used=$((mem_used / 1024 / 1024)) mem_used=$((mem_used / 1024 / 1024))
mem_full=$((mem_full / 1024 / 1024)) mem_full=$((mem_full / 1024 / 1024))
;; ;;
Minix)
# Minix includes the '/proc' filesystem though the format
# differs from Linux. The '/proc/meminfo' file is only a
# single line with space separated elements and elements
# 2 and 3 contain the total and free memory numbers.
read -r _ mem_full mem_free _ < /proc/meminfo
mem_used=$(((mem_full - mem_free) / 1024))
mem_full=$(( mem_full / 1024))
;;
esac esac
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6 log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6