Merge pull request #142 from Crestwave/serenity

os: SerenityOS support
This commit is contained in:
dylan 2021-09-04 20:14:29 +03:00 committed by GitHub
commit 1af3f53eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 1 deletions

View File

@ -38,6 +38,7 @@ picture"!
- **Minix** - **Minix**
- **Solaris** - **Solaris**
- **IRIX** - **IRIX**
- **SerenityOS**
## Configuration ## Configuration

48
pfetch
View File

@ -484,7 +484,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* | Minix*) (Linux* | Minix* | SerenityOS*)
IFS=. read -r s _ < /proc/uptime IFS=. read -r s _ < /proc/uptime
;; ;;
@ -649,6 +649,13 @@ get_pkgs() {
(IRIX) (IRIX)
versions -b versions -b
;; ;;
(SerenityOS)
while IFS=" " read -r type _; do
[ "$type" != dependency ] &&
printf "\n"
done < /usr/Ports/packages.db
;;
esac | wc -l esac | wc -l
) )
@ -899,6 +906,33 @@ get_memory() {
mem_used=$((mem_full - mem_free)) 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 esac
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6 log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
@ -1633,6 +1667,18 @@ get_ascii() {
EOF 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*) ([Ss]lackware*)
read_ascii 4 <<-EOF read_ascii 4 <<-EOF
${c4} ________ ${c4} ________