pfetch: initial solaris support
This commit is contained in:
parent
300f31c5cd
commit
a9af270b96
34
pfetch
34
pfetch
|
@ -100,8 +100,8 @@ log() {
|
||||||
|
|
||||||
get_title() {
|
get_title() {
|
||||||
# Username is retrieved by first checking '$USER' with a fallback
|
# Username is retrieved by first checking '$USER' with a fallback
|
||||||
# to the 'whoami' command.
|
# to the 'id -un' command.
|
||||||
user=${USER:-$(whoami)}
|
user=${USER:-$(id -un)}
|
||||||
|
|
||||||
# Hostname is retrieved by first checking '$HOSTNAME' with a fallback
|
# Hostname is retrieved by first checking '$HOSTNAME' with a fallback
|
||||||
# to the 'hostname' command.
|
# to the 'hostname' command.
|
||||||
|
@ -246,6 +246,10 @@ get_os() {
|
||||||
trap '' EXIT
|
trap '' EXIT
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
SunOS)
|
||||||
|
IFS='(' read -r distro _ < /etc/release
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
# Catch all to ensure '$distro' is never blank.
|
# Catch all to ensure '$distro' is never blank.
|
||||||
# This also handles the BSDs.
|
# This also handles the BSDs.
|
||||||
|
@ -367,6 +371,12 @@ get_uptime() {
|
||||||
# regular seconds.
|
# regular seconds.
|
||||||
s=$(($(system_time) / 1000000))
|
s=$(($(system_time) / 1000000))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
SunOS)
|
||||||
|
IFS=' .' read -r _ s _ <<-EOF
|
||||||
|
$(kstat -p unix:0:system_misc:snaptime)
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Convert the uptime from seconds into days, hours and minutes.
|
# Convert the uptime from seconds into days, hours and minutes.
|
||||||
|
@ -456,6 +466,11 @@ get_pkgs() {
|
||||||
Minix)
|
Minix)
|
||||||
printf '%s\n' /usr/pkg/var/db/pkg/*/
|
printf '%s\n' /usr/pkg/var/db/pkg/*/
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
SunOS)
|
||||||
|
has pkginfo && pkginfo -i
|
||||||
|
has pkg && pkg list
|
||||||
|
;;
|
||||||
esac | wc -l
|
esac | wc -l
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -612,6 +627,21 @@ get_memory() {
|
||||||
mem_used=$(((mem_full - mem_free) / 1024))
|
mem_used=$(((mem_full - mem_free) / 1024))
|
||||||
mem_full=$(( mem_full / 1024))
|
mem_full=$(( mem_full / 1024))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
SunOS)
|
||||||
|
hw_pagesize=$(pagesize)
|
||||||
|
|
||||||
|
while read -r _ p; do
|
||||||
|
: "${pages_total:+"${pages_free="$p"}"}" "${pages_total="$p"}"
|
||||||
|
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
|
esac
|
||||||
|
|
||||||
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
|
log memory "${mem_used:-?}M / ${mem_full:-?}M" >&6
|
||||||
|
|
Loading…
Reference in New Issue
Block a user