pfetch: more BSD support

This commit is contained in:
Dylan Araps 2019-09-24 21:05:15 +03:00
parent 6a9d36bdb9
commit 4f3b0005ff

14
pfetch
View File

@ -134,7 +134,7 @@ get_kernel() {
case $os in case $os in
# Don't print kernel output on BSD systems as the # Don't print kernel output on BSD systems as the
# OS name includes it. # OS name includes it.
*BSD) ;; *BSD*) ;;
*) *)
log kernel "$kernel" log kernel "$kernel"
@ -154,6 +154,14 @@ get_host() {
host="$name $version $model" host="$name $version $model"
;; ;;
Darwin*)
host=$(sysctl -n hw.model)
;;
*BSD*)
host=$(sysctl -n hw.vendor hw.product)
;;
esac esac
log host "$host" log host "$host"
@ -168,7 +176,7 @@ get_uptime() {
IFS=. read -r s _ < /proc/uptime IFS=. read -r s _ < /proc/uptime
;; ;;
Darwin*|BSD*) Darwin*|*BSD*)
s=$(sysctl -n kern.boottime) s=$(sysctl -n kern.boottime)
# Extract the uptime in seconds from the following output: # Extract the uptime in seconds from the following output:
@ -238,7 +246,7 @@ get_pkgs() {
has pkg && pkg info has pkg && pkg info
;; ;;
BSD*) *BSD*)
# Commands which print packages one per line. # Commands which print packages one per line.
has pkginfo && pkginfo -i has pkginfo && pkginfo -i
has pkg && pkg list has pkg && pkg list