From 37280d7851d8a5d04c08e7fe9e34eca6fd3e4e05 Mon Sep 17 00:00:00 2001 From: Crestwave Date: Fri, 27 Aug 2021 10:57:10 +0800 Subject: [PATCH 1/2] os: SerenityOS support --- pfetch | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/pfetch b/pfetch index 8315f44..e311bc8 100755 --- a/pfetch +++ b/pfetch @@ -483,7 +483,7 @@ get_uptime() { # converting that data into days, hours and minutes using simple # math. case $os in - (Linux* | Minix*) + (Linux* | Minix* | SerenityOS*) IFS=. read -r s _ < /proc/uptime ;; @@ -648,6 +648,13 @@ get_pkgs() { (IRIX) versions -b ;; + + (SerenityOS) + while IFS=" " read -r type _; do + [ "$type" != dependency ] && + printf "\n" + done < /usr/Ports/packages.db + ;; esac | wc -l ) @@ -898,6 +905,33 @@ get_memory() { mem_used=$((mem_full - mem_free)) ;; + + (SerenityOS) + IFS='{}' read -r _ memstat _ < /proc/memstat + + set -f -- "$IFS" + IFS=, + + for pair in $memstat; do + case $pair in + (*user_physical_allocated*) + mem_used=${pair##*:} + ;; + + (*user_physical_available*) + mem_free=${pair##*:} + ;; + esac + done + + IFS=$1 + set +f -- + + mem_used=$((mem_used * 4096 / 1024 / 1024)) + mem_free=$((mem_free * 4096 / 1024 / 1024)) + + mem_full=$((mem_used + mem_free)) + ;; esac log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6 @@ -1630,6 +1664,18 @@ get_ascii() { EOF ;; + ([Ss]erenity[Oo][Ss]*) + read_ascii 4 <<-EOF + ${c7} _____ + ${c1} ,-${c7} -, + ${c1} ;${c7} ( ; + ${c1}| ${c7}. \_${c1}.,${c7} | + ${c1}| ${c7}o _${c1} ',${c7} | + ${c1} ; ${c7}(_)${c1} )${c7} ; + ${c1} '-_____-${c7}' + EOF + ;; + ([Ss]lackware*) read_ascii 4 <<-EOF ${c4} ________ From 44eb86af51b957429a58e26182f473a01cf0eeb4 Mon Sep 17 00:00:00 2001 From: Crestwave Date: Fri, 27 Aug 2021 12:22:08 +0800 Subject: [PATCH 2/2] docs: add SerenityOS --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7d4a816..96bef2e 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ picture"! - **Minix** - **Solaris** - **IRIX** +- **SerenityOS** ## Configuration