os: SerenityOS support

This commit is contained in:
Crestwave 2021-08-27 10:57:10 +08:00
parent 428dd23578
commit 37280d7851

48
pfetch
View File

@ -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} ________