aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-09-30 20:08:27 +0300
committerDylan Araps <dylan.araps@gmail.com>2019-09-30 20:08:27 +0300
commitc9d961836c187a1253d89394de73e420fa967775 (patch)
tree73475a60d8f60231c15c69b2c88fc69abf28cb8e
parent3a8ac8c53da3edbcc282281a4fde52d013426112 (diff)
downloadpfetch-c9d961836c187a1253d89394de73e420fa967775.tar.gz
solaris: comments
-rwxr-xr-xpfetch13
1 files changed, 11 insertions, 2 deletions
diff --git a/pfetch b/pfetch
index c2cad1e..a58a506 100755
--- a/pfetch
+++ b/pfetch
@@ -251,6 +251,8 @@ get_os() {
;;
SunOS)
+ # Grab the first line of the '/etc/release' file
+ # discarding everything after '('.
IFS='(' read -r distro _ < /etc/release
;;
@@ -377,6 +379,13 @@ get_uptime() {
;;
SunOS)
+ # Split the output of 'kstat' on '.' and any white-space
+ # which exists in the command output.
+ #
+ # The output is as follows:
+ # unix:0:system_misc:snaptime 14809.906993005
+ #
+ # The parser extracts: ^^^^^
IFS=' .' read -r _ s _ <<-EOF
$(kstat -p unix:0:system_misc:snaptime)
EOF
@@ -637,7 +646,7 @@ get_memory() {
while read -r key val; do
case $key in
- *total) pages_total=$val ;;
+ *total) pages_full=$val ;;
*free) pages_free=$val ;;
esac
done <<-EOF
@@ -645,7 +654,7 @@ get_memory() {
unix:0:system_pages:pagesfree)
EOF
- mem_full=$((pages_total * hw_pagesize / 1024 / 1024))
+ mem_full=$((pages_full * hw_pagesize / 1024 / 1024))
mem_free=$((pages_free * hw_pagesize / 1024 / 1024))
mem_used=$((mem_full - mem_free))
;;