Merge pull request #18 from Crestwave/solaris
pfetch: initial solaris support
This commit is contained in:
commit
3a8ac8c53d
33
pfetch
33
pfetch
|
@ -250,6 +250,10 @@ get_os() {
|
|||
trap '' EXIT
|
||||
;;
|
||||
|
||||
SunOS)
|
||||
IFS='(' read -r distro _ < /etc/release
|
||||
;;
|
||||
|
||||
*)
|
||||
# Catch all to ensure '$distro' is never blank.
|
||||
# This also handles the BSDs.
|
||||
|
@ -371,6 +375,12 @@ get_uptime() {
|
|||
# regular seconds.
|
||||
s=$(($(system_time) / 1000000))
|
||||
;;
|
||||
|
||||
SunOS)
|
||||
IFS=' .' read -r _ s _ <<-EOF
|
||||
$(kstat -p unix:0:system_misc:snaptime)
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
# Convert the uptime from seconds into days, hours and minutes.
|
||||
|
@ -460,6 +470,11 @@ get_pkgs() {
|
|||
Minix)
|
||||
printf '%s\n' /usr/pkg/var/db/pkg/*/
|
||||
;;
|
||||
|
||||
SunOS)
|
||||
has pkginfo && pkginfo -i
|
||||
has pkg && pkg list
|
||||
;;
|
||||
esac | wc -l
|
||||
`
|
||||
|
||||
|
@ -616,6 +631,24 @@ get_memory() {
|
|||
mem_used=$(((mem_full - mem_free) / 1024))
|
||||
mem_full=$(( mem_full / 1024))
|
||||
;;
|
||||
|
||||
SunOS)
|
||||
hw_pagesize=$(pagesize)
|
||||
|
||||
while read -r key val; do
|
||||
case $key in
|
||||
*total) pages_total=$val ;;
|
||||
*free) pages_free=$val ;;
|
||||
esac
|
||||
done <<-EOF
|
||||
$(kstat -p unix:0:system_pages:pagestotal \
|
||||
unix:0:system_pages:pagesfree)
|
||||
EOF
|
||||
|
||||
mem_full=$((pages_total * hw_pagesize / 1024 / 1024))
|
||||
mem_free=$((pages_free * hw_pagesize / 1024 / 1024))
|
||||
mem_used=$((mem_full - mem_free))
|
||||
;;
|
||||
esac
|
||||
|
||||
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
|
||||
|
|
Loading…
Reference in New Issue
Block a user