aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpfetch64
1 files changed, 63 insertions, 1 deletions
diff --git a/pfetch b/pfetch
index 9e119eb..4058c39 100755
--- a/pfetch
+++ b/pfetch
@@ -216,7 +216,7 @@ get_kernel() {
case $os in
# Don't print kernel output on some systems as the
# OS name includes it.
- *BSD*|Haiku|Minix) ;;
+ *BSD*|Haiku|Minix|IRIX) ;;
*)
# '$kernel' is the cached output of 'uname -r'.
@@ -334,6 +334,25 @@ get_uptime() {
$(kstat -p unix:0:system_misc:snaptime)
EOF
;;
+
+ IRIX)
+ # Grab the uptime in a pretty format. Usually,
+ # 00:00:00 from the 'ps' command.
+ t=$(LC_ALL=POSIX ps -o etime= -p 1)
+
+ # Split the pretty output into days or hours
+ # based on the uptime.
+ case $t in
+ *-*) d=${t%%-*} t=${t#*-} ;;
+ *:*:*) h=${t%%:*} t=${t#*:} ;;
+ esac
+
+ h=${h#0} t=${t#0}
+
+ # Convert the split pretty fields back into
+ # seconds so we may re-convert them to our format.
+ s=$((${d:-0}*86400 + ${h:-0}*3600 + ${t%%:*}*60 + ${t#*:}))
+ ;;
esac
# Convert the uptime from seconds into days, hours and minutes.
@@ -445,9 +464,19 @@ get_pkgs() {
has pkginfo && pkginfo -i
has pkg && pkg list
;;
+
+ IRIX)
+ versions -b
+ ;;
esac | wc -l
`
+ case $os in
+ # IRIX's package manager adds 3 lines of extra
+ # output which we must account for here.
+ IRIX) packages=$((packages - 3)) ;;
+ esac
+
[ "$packages" -gt 1 ] && log pkgs "$packages"
}
@@ -628,6 +657,27 @@ get_memory() {
mem_free=$((pages_free * hw_pagesize / 1024 / 1024))
mem_used=$((mem_full - mem_free))
;;
+
+ IRIX)
+ # Read the memory information from the 'top' command. Parse
+ # and split each line until we reach the line starting with
+ # "Memory".
+ #
+ # Example output: Memory: 160M max, 147M avail, .....
+ while IFS=' :' read -r label mem_full _ mem_free _; do
+ case $label in
+ Memory)
+ mem_full=${mem_full%M}
+ mem_free=${mem_free%M}
+ break
+ ;;
+ esac
+ done <<-EOF
+ $(top -n)
+ EOF
+
+ mem_used=$((mem_full - mem_free))
+ ;;
esac
log memory "${mem_used:-?}M / ${mem_full:-?}M"
@@ -1033,6 +1083,18 @@ get_ascii() {
EOF
;;
+ [Ii][Rr][Ii][Xx]*)
+ read_ascii 4 <<-EOF
+ TODO
+ TODO
+ TODO
+ TODO
+ TODO
+ TODO
+ TODO
+ EOF
+ ;;
+
[Ll]inux*[Ll]ite*|[Ll]ite*)
read_ascii 3 <<-EOF
${c3} /\\