Added more support for OpenBSD. I'm installing OpenBSD to test.

This commit is contained in:
dylan araps 2016-01-04 08:48:50 +11:00
parent b645fd71c5
commit 70af2fc12d

View file

@ -217,7 +217,7 @@ getuptime () {
;; ;;
"OpenBSD") "OpenBSD")
uptime=$(uptime | awk -F, '{ print $1 }') uptime=$(uptime | awk -F',' '{ print $1 }')
uptime=${uptime# } uptime=${uptime# }
uptime="${uptime# * up }" uptime="${uptime# * up }"
;; ;;
@ -303,6 +303,10 @@ getcpu () {
cpu="$(sysctl -n machdep.cpu.brand_string)" cpu="$(sysctl -n machdep.cpu.brand_string)"
;; ;;
"OpenBSD")
cpu="$(sysctl -n hw.model)"
;;
*) *)
cpu="$(awk -F ': ' '/model name/ {printf $2; exit}' /proc/cpuinfo)" cpu="$(awk -F ': ' '/model name/ {printf $2; exit}' /proc/cpuinfo)"
@ -343,6 +347,14 @@ getmemory () {
memory="${memused}MB / ${memtotal}MB" memory="${memused}MB / ${memtotal}MB"
;; ;;
"OpenBSD")
memtotal=$(dmesg | awk '/real mem/ {printf $5}')
memused=$(top -1 1 | awk '/Real:/ {print $3}')
memtotal=${memtotal/()MB/}
memused=${memused/M/}
memory="${memused}MB / ${memtotal}MB"
;;
*) *)
mem="$(awk 'NR < 4 {printf $2 " "}' /proc/meminfo)" mem="$(awk 'NR < 4 {printf $2 " "}' /proc/meminfo)"