From c9c27ba54b16d1b561709191926b8e790b45e0e3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 28 Sep 2019 13:11:49 +0300 Subject: [PATCH] initial minux support --- pfetch | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pfetch b/pfetch index cca642d..0bf7095 100755 --- a/pfetch +++ b/pfetch @@ -250,7 +250,7 @@ get_kernel() { case $os in # Don't print kernel output on some systems as the # OS name includes it. - *BSD*|Haiku) ;; + *BSD*|Haiku|Minix) ;; *) # '$kernel' is the cached output of 'uname -r'. @@ -337,7 +337,7 @@ get_uptime() { # converting that data into days, hours and minutes using simple # math. case $os in - Linux*) + Linux*|Minix*) IFS=. read -r s _ < /proc/uptime ;; @@ -444,6 +444,10 @@ get_pkgs() { Haiku) printf '%s\n' /boot/system/package-links/* ;; + + Minix) + printf '%s\n' /usr/pkg/var/db/pkg/*/ + ;; esac | wc -l ` @@ -589,6 +593,17 @@ get_memory() { mem_used=$((mem_used / 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 log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6