From 21f1faec6222c62fc44d025e5a3e3c8b9dba66d9 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Sun, 31 Dec 2017 14:50:28 -0500 Subject: [PATCH 1/8] Support added for FreeMiNT on Atari computers and clones/VMs --- ascii/distro/gem | 19 ++++++++++ neofetch | 97 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 ascii/distro/gem diff --git a/ascii/distro/gem b/ascii/distro/gem new file mode 100644 index 00000000..d69ae938 --- /dev/null +++ b/ascii/distro/gem @@ -0,0 +1,19 @@ + + + ${c1} ## + ## ######### + #### ## + #### #### ## + #### #### ## ## + #### #### ## ## + #### #### ## ## ## + #### ###### + ###### ## ## #### + #### ################ + #### ## #### + ## #### ###### + ## ## #### #### + ## ## ## ## ## #### + #### ## ## ## + + diff --git a/neofetch b/neofetch index 977ead29..4d629770 100755 --- a/neofetch +++ b/neofetch @@ -44,6 +44,7 @@ get_os() { "MINIX") os="MINIX" ;; "AIX") os="AIX" ;; "IRIX64") os="IRIX" ;; + "FreeMiNT") os="FreeMiNT" ;; *) printf "%s\n" "Unknown OS detected: '$kernel_name', aborting..." >&2 printf "%s\n" "Open an issue on GitHub to add support for your OS." >&2 @@ -230,6 +231,10 @@ get_distro() { "IRIX") distro="IRIX ${kernel_version}" ;; + + "FreeMiNT") + distro="FreeMiNT" + ;; esac distro="${distro//Enterprise Server}" @@ -238,7 +243,7 @@ get_distro() { # Get OS architecture. case "$os" in - "Solaris" | "AIX" | "Haiku" | "IRIX") machine_arch="$(uname -p)" ;; + "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") machine_arch="$(uname -p)" ;; *) machine_arch="$(uname -m)" ;; esac @@ -340,6 +345,10 @@ get_model() { "AIX") model="$(/usr/bin/uname -M)" ;; + + "FreeMiNT") + model="$(sysctl -n hw.model)" + ;; esac # Remove dummy OEM info. @@ -426,6 +435,13 @@ get_uptime() { h="${h#0}" t="${t#0}" seconds="$((d*86400 + h*3600 + ${t%%:*}*60 + ${t#*:}))" ;; + + "FreeMiNT") + boot="$(sysctl -n kern.boottime)" + now="$(date +%s)" + seconds="$((now - boot))" + ;; + esac days="$((seconds / 60 / 60 / 24)) days" @@ -604,6 +620,12 @@ get_packages() { "IRIX") packages="$(($(versions -b | wc -l)-3))" ;; + + "FreeMiNT") + type -p rpm >/dev/null && \ + packages="$((packages+=$(rpm -qa | wc -l)))" + ;; + esac ((packages == 0)) && unset packages @@ -653,6 +675,26 @@ get_de() { esac ;; + "FreeMiNT") + get_wm + + if [ -e /proc/thing* ]; then + de="Thing" + elif [ -e /proc/jinnee* ]; then + de="Jinnee" + elif [ -e /proc/tera* ]; then + de="Teradesk" + elif [ -e /proc/mdesk ]; then + de="mDesk" + elif [ -e /proc/neod* ]; then + de="NeoDesk" + elif [ -e /proc/zdesk* ]; then + de="zDesk" + else + de="Atari" + fi + ;; + *) ((wm_run != 1)) && get_wm @@ -727,7 +769,7 @@ get_wm() { -e "westford" \ -e "weston")" - elif [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then + elif [[ "$DISPLAY" && "$os" != "Mac OS X" && "$os" != "FreeMiNT" ]]; then id="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)" id="${id##* }" wm="$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)" @@ -763,6 +805,21 @@ get_wm() { [[ "$wm" == "blackbox" ]] && wm="bbLean (Blackbox)" wm="${wm:+$wm, }Explorer" ;; + + "FreeMiNT") + if [ -e /proc/xaaes* ]; then + wm="XaAES" + elif [ -e /proc/myaes* ]; then + wm="MyAES" + elif [ -e /proc/naes* ]; then + wm="N.AES" + elif [ -e /proc/geneva* ]; then + wm="Geneva" + else + wm="Atari AES" + fi + ;; + esac fi @@ -1104,6 +1161,12 @@ get_cpu() { # Get CPU cores. cores="$(sysconf NPROC_ONLN)" ;; + + "FreeMiNT") + cpu="$(cat /kern/cpuinfo | awk -F':' '/CPU:/ {printf $2}')" + speed="$(cat /kern/cpuinfo | awk -F':' '/Clocking:/ {printf $2}' | awk -F'.' '{ printf $1 }')" + ;; + esac # Remove un-needed patterns from cpu output. @@ -1188,7 +1251,8 @@ get_cpu_usage() { "Haiku") cores="$(sysinfo -cpu | grep -c -F 'CPU #')" ;; "iPhone OS") cores="${cpu/*\(}"; cores="${cores/\)*}" ;; "AIX") cores="$(lparstat -i | awk -F':' '/Online Virtual CPUs/ {printf $2}')" ;; - "IRIX") cores="$(sysconf NPROC_ONLN)" + "IRIX") cores="$(sysconf NPROC_ONLN)" ;; + "FreeMiNT") cores="$(sysctl -n hw.ncpu)" esac fi @@ -1445,6 +1509,15 @@ get_memory() { mem_free="$((mem_stat[5] / 1024))" mem_used="$((mem_total - mem_free))" ;; + + "FreeMiNT") + mem_total="$(cat /kern/meminfo | awk -F ':|kB' '/MemTotal:/ {printf $2}')" + mem_free="$(cat /kern/meminfo | awk -F ':|kB' '/MemFree:/ {printf $2}')" + mem_used="$(( mem_total - mem_free ))" + mem_total="$(( mem_total / 1024 ))" + mem_used="$(( mem_used / 1024 ))" + ;; + esac memory="${mem_used}${mem_label:-MiB} / ${mem_total}${mem_label:-MiB}" @@ -1833,6 +1906,11 @@ get_term() { *) term="${TERM_PROGRAM/\.app}" ;; esac + # Most likely TosWin2 on FreeMiNT - quick check + if [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]]; then + term="TosWin2" + fi + # Check $PPID for terminal emulator. while [[ -z "$term" ]]; do if [[ "$SSH_CONNECTION" ]]; then @@ -2384,6 +2462,12 @@ get_cols() { unset -v blocks blocks2 cols + # TosWin2 on FreeMiNT is terrible at this, + # so we'll reset colors arbitrarily + if [ "${term}" == "TosWin2" ]; then + printf "%b\n" "\\e[30;47m" + fi + # Tell info() that we printed manually. prin=1 } @@ -3368,6 +3452,13 @@ get_distro_colors() { ascii_file="freebsd" ;; + "FreeMiNT"*) + # Don't explicitly set colors since + # TosWin2 doesn't reset well + # set_colors 0 + ascii_file="gem" + ;; + "Frugalware"*) set_colors 4 7 1 ascii_file="frugalware" From 69c219e351db5f3cf78447409cdaddd46fc7f845 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Mon, 1 Jan 2018 12:20:07 -0500 Subject: [PATCH 2/8] Formatting fixes and awk improvements for FreeMiNT. Changed method for finding DE and WM processes in FreeMiNT. --- ascii/distro/gem | 34 +++++++++++------------- neofetch | 69 ++++++++++++++++++++---------------------------- 2 files changed, 43 insertions(+), 60 deletions(-) diff --git a/ascii/distro/gem b/ascii/distro/gem index d69ae938..49c8849d 100644 --- a/ascii/distro/gem +++ b/ascii/distro/gem @@ -1,19 +1,15 @@ - - - ${c1} ## - ## ######### - #### ## - #### #### ## - #### #### ## ## - #### #### ## ## - #### #### ## ## ## - #### ###### - ###### ## ## #### - #### ################ - #### ## #### - ## #### ###### - ## ## #### #### - ## ## ## ## ## #### - #### ## ## ## - - +${c1} ## + ## ######### + #### ## + #### #### ## +#### #### ## ## + #### #### ## ## + #### #### ## ## ## + #### ###### + ###### ## ## #### + #### ################ + #### ## #### + ## #### ###### + ## ## #### #### + ## ## ## ## ## #### + #### ## ## ## diff --git a/neofetch b/neofetch index 4d629770..d01c63dd 100755 --- a/neofetch +++ b/neofetch @@ -441,7 +441,6 @@ get_uptime() { now="$(date +%s)" seconds="$((now - boot))" ;; - esac days="$((seconds / 60 / 60 / 24)) days" @@ -625,7 +624,6 @@ get_packages() { type -p rpm >/dev/null && \ packages="$((packages+=$(rpm -qa | wc -l)))" ;; - esac ((packages == 0)) && unset packages @@ -678,21 +676,16 @@ get_de() { "FreeMiNT") get_wm - if [ -e /proc/thing* ]; then - de="Thing" - elif [ -e /proc/jinnee* ]; then - de="Jinnee" - elif [ -e /proc/tera* ]; then - de="Teradesk" - elif [ -e /proc/mdesk ]; then - de="mDesk" - elif [ -e /proc/neod* ]; then - de="NeoDesk" - elif [ -e /proc/zdesk* ]; then - de="zDesk" - else - de="Atari" - fi + for possibles in "$(ls /proc)"; do + case "$possibles" in + *thing*) de="Thing" ;; + *jinnee*) de="Jinnee" ;; + *tera*) de="Teradesk" ;; + *neod*) de="NeoDesk" ;; + *zdesk*) de="zDesk" ;; + *mdesk*) de="mDesk" ;; + esac + done ;; *) @@ -807,19 +800,16 @@ get_wm() { ;; "FreeMiNT") - if [ -e /proc/xaaes* ]; then - wm="XaAES" - elif [ -e /proc/myaes* ]; then - wm="MyAES" - elif [ -e /proc/naes* ]; then - wm="N.AES" - elif [ -e /proc/geneva* ]; then - wm="Geneva" - else - wm="Atari AES" - fi + wm="Atari AES" + for possibles in "$(ls /proc | awk -F'[ .]' '/aes|geneva/ {print $1}')"; do + case "$possibles" in + *xaaes*) wm="XaAES" ;; + *myaes*) wm="MyAES" ;; + *naes*) wm="N.AES" ;; + geneva) wm="Geneva" ;; + esac + done ;; - esac fi @@ -1163,10 +1153,9 @@ get_cpu() { ;; "FreeMiNT") - cpu="$(cat /kern/cpuinfo | awk -F':' '/CPU:/ {printf $2}')" - speed="$(cat /kern/cpuinfo | awk -F':' '/Clocking:/ {printf $2}' | awk -F'.' '{ printf $1 }')" + cpu="$(awk -F':' '/CPU:/ {printf $2}' /kern/cpuinfo)" + speed="$(awk -F'[:.]' '/Clocking:/ {printf $2}' /kern/cpuinfo)" ;; - esac # Remove un-needed patterns from cpu output. @@ -1511,11 +1500,11 @@ get_memory() { ;; "FreeMiNT") - mem_total="$(cat /kern/meminfo | awk -F ':|kB' '/MemTotal:/ {printf $2}')" - mem_free="$(cat /kern/meminfo | awk -F ':|kB' '/MemFree:/ {printf $2}')" - mem_used="$(( mem_total - mem_free ))" - mem_total="$(( mem_total / 1024 ))" - mem_used="$(( mem_used / 1024 ))" + mem_total="$(awk -F ':|kB' '/MemTotal:/ {printf $2}' /kern/meminfo)" + mem_free="$(awk -F ':|kB' '/MemFree:/ {printf $2}' /kern/meminfo)" + mem_used="$((mem_total - mem_free))" + mem_total="$((mem_total / 1024))" + mem_used="$((mem_used / 1024))" ;; esac @@ -1907,9 +1896,8 @@ get_term() { esac # Most likely TosWin2 on FreeMiNT - quick check - if [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]]; then + [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && \ term="TosWin2" - fi # Check $PPID for terminal emulator. while [[ -z "$term" ]]; do @@ -2464,9 +2452,8 @@ get_cols() { # TosWin2 on FreeMiNT is terrible at this, # so we'll reset colors arbitrarily - if [ "${term}" == "TosWin2" ]; then + [[ "$term" == "TosWin2" ]] && \ printf "%b\n" "\\e[30;47m" - fi # Tell info() that we printed manually. prin=1 From 82875114fe79fac4cbbc74296f47046b60ca5c9b Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Tue, 2 Jan 2018 20:33:54 -0500 Subject: [PATCH 3/8] Additional FreeMiNT simplifications. Added careful fix for CPU clocking check on FreeMiNT. --- neofetch | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/neofetch b/neofetch index d01c63dd..429e3f70 100755 --- a/neofetch +++ b/neofetch @@ -412,7 +412,7 @@ get_uptime() { seconds="${seconds/.*}" ;; - "Mac OS X" | "iPhone OS" | "BSD") + "Mac OS X" | "iPhone OS" | "BSD" | "FreeMiNT") boot="$(sysctl -n kern.boottime)" boot="${boot/'{ sec = '}" boot="${boot/,*}" @@ -435,12 +435,6 @@ get_uptime() { h="${h#0}" t="${t#0}" seconds="$((d*86400 + h*3600 + ${t%%:*}*60 + ${t#*:}))" ;; - - "FreeMiNT") - boot="$(sysctl -n kern.boottime)" - now="$(date +%s)" - seconds="$((now - boot))" - ;; esac days="$((seconds / 60 / 60 / 24)) days" @@ -676,8 +670,8 @@ get_de() { "FreeMiNT") get_wm - for possibles in "$(ls /proc)"; do - case "$possibles" in + for files in /proc/*; do + case "$files" in *thing*) de="Thing" ;; *jinnee*) de="Jinnee" ;; *tera*) de="Teradesk" ;; @@ -801,8 +795,8 @@ get_wm() { "FreeMiNT") wm="Atari AES" - for possibles in "$(ls /proc | awk -F'[ .]' '/aes|geneva/ {print $1}')"; do - case "$possibles" in + for files in /proc/*; do + case "$files" in *xaaes*) wm="XaAES" ;; *myaes*) wm="MyAES" ;; *naes*) wm="N.AES" ;; @@ -1154,7 +1148,7 @@ get_cpu() { "FreeMiNT") cpu="$(awk -F':' '/CPU:/ {printf $2}' /kern/cpuinfo)" - speed="$(awk -F'[:.]' '/Clocking:/ {printf $2}' /kern/cpuinfo)" + speed="$(awk -F '[:.M]' '/Clocking:/ {printf $2}' /kern/cpuinfo)" ;; esac @@ -1500,8 +1494,9 @@ get_memory() { ;; "FreeMiNT") - mem_total="$(awk -F ':|kB' '/MemTotal:/ {printf $2}' /kern/meminfo)" - mem_free="$(awk -F ':|kB' '/MemFree:/ {printf $2}' /kern/meminfo)" + mem="$(awk -F ':|kB' '/MemTotal:|MemFree:/ {printf $2, " "}' /kern/meminfo)" + mem_free="${mem/* }" + mem_total="${mem/ *}" mem_used="$((mem_total - mem_free))" mem_total="$((mem_total / 1024))" mem_used="$((mem_used / 1024))" From 0f4fcc46df41898a07172dc2c926ffacfb286abd Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 3 Jan 2018 20:16:08 -0500 Subject: [PATCH 4/8] Minor comment updates in FreeMiNT sections. --- neofetch | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 429e3f70..f8e88c34 100755 --- a/neofetch +++ b/neofetch @@ -2446,7 +2446,7 @@ get_cols() { unset -v blocks blocks2 cols # TosWin2 on FreeMiNT is terrible at this, - # so we'll reset colors arbitrarily + # so we'll reset colors arbitrarily. [[ "$term" == "TosWin2" ]] && \ printf "%b\n" "\\e[30;47m" @@ -3436,8 +3436,7 @@ get_distro_colors() { "FreeMiNT"*) # Don't explicitly set colors since - # TosWin2 doesn't reset well - # set_colors 0 + # TosWin2 doesn't reset well. ascii_file="gem" ;; From a9ed7835d509e2e55cc383ab6072b2b432d94f4a Mon Sep 17 00:00:00 2001 From: szfcbr Date: Fri, 5 Jan 2018 05:44:44 +0100 Subject: [PATCH 5/8] OS: detect 32-bit IRIX --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index f8e88c34..bb24eb00 100755 --- a/neofetch +++ b/neofetch @@ -43,7 +43,7 @@ get_os() { "Haiku") os="Haiku" ;; "MINIX") os="MINIX" ;; "AIX") os="AIX" ;; - "IRIX64") os="IRIX" ;; + "IRIX64" | "IRIX") os="IRIX" ;; "FreeMiNT") os="FreeMiNT" ;; *) printf "%s\n" "Unknown OS detected: '$kernel_name', aborting..." >&2 From 6c3b0136dee6f44b24e80a70eb88b8a3b83747d6 Mon Sep 17 00:00:00 2001 From: szfcbr Date: Fri, 5 Jan 2018 06:32:14 +0100 Subject: [PATCH 6/8] Shells: add support for tcsh --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index f8e88c34..0c248db6 100755 --- a/neofetch +++ b/neofetch @@ -640,6 +640,10 @@ get_shell() { shell="${shell/version}" ;; + "tcsh") + shell+="$("$SHELL" -c 'printf "%s" "$tcsh"')" + ;; + *) shell+="$("$SHELL" --version 2>&1)" shell="${shell/ "${shell_name}"}" From d296741ac2914da848f44c9efc853ab1b8f0b8b4 Mon Sep 17 00:00:00 2001 From: szfcbr Date: Fri, 5 Jan 2018 07:05:47 +0100 Subject: [PATCH 7/8] Revert "OS: detect 32-bit IRIX" This reverts commit a9ed7835d509e2e55cc383ab6072b2b432d94f4a. --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index bb24eb00..f8e88c34 100755 --- a/neofetch +++ b/neofetch @@ -43,7 +43,7 @@ get_os() { "Haiku") os="Haiku" ;; "MINIX") os="MINIX" ;; "AIX") os="AIX" ;; - "IRIX64" | "IRIX") os="IRIX" ;; + "IRIX64") os="IRIX" ;; "FreeMiNT") os="FreeMiNT" ;; *) printf "%s\n" "Unknown OS detected: '$kernel_name', aborting..." >&2 From 1000547569b514de13e6dbfe8364b947c57ba2f0 Mon Sep 17 00:00:00 2001 From: szfcbr Date: Fri, 5 Jan 2018 07:07:59 +0100 Subject: [PATCH 8/8] OS: detect 32-bit IRIX --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index f8e88c34..a9feae92 100755 --- a/neofetch +++ b/neofetch @@ -43,7 +43,7 @@ get_os() { "Haiku") os="Haiku" ;; "MINIX") os="MINIX" ;; "AIX") os="AIX" ;; - "IRIX64") os="IRIX" ;; + "IRIX"*) os="IRIX" ;; "FreeMiNT") os="FreeMiNT" ;; *) printf "%s\n" "Unknown OS detected: '$kernel_name', aborting..." >&2