Formatting fixes and awk improvements for FreeMiNT. Changed method for finding DE and WM processes in FreeMiNT.

This commit is contained in:
Jeffrey Armstrong 2018-01-01 12:20:07 -05:00
parent 21f1faec62
commit 69c219e351
2 changed files with 43 additions and 60 deletions

View file

@ -1,19 +1,15 @@
${c1} ##
## #########
${c1} ## #### ##
## ######### #### #### ##
#### ## #### #### ## ##
#### #### ## #### #### ## ##
#### #### ## ## #### #### ## ## ##
#### #### ## ## #### ######
#### #### ## ## ## ###### ## ## ####
#### ###### #### ################
###### ## ## #### #### ## ####
#### ################ ## #### ######
#### ## #### ## ## #### ####
## #### ###### ## ## ## ## ## ####
## ## #### #### #### ## ## ##
## ## ## ## ## ####
#### ## ## ##

View file

@ -441,7 +441,6 @@ get_uptime() {
now="$(date +%s)" now="$(date +%s)"
seconds="$((now - boot))" seconds="$((now - boot))"
;; ;;
esac esac
days="$((seconds / 60 / 60 / 24)) days" days="$((seconds / 60 / 60 / 24)) days"
@ -625,7 +624,6 @@ get_packages() {
type -p rpm >/dev/null && \ type -p rpm >/dev/null && \
packages="$((packages+=$(rpm -qa | wc -l)))" packages="$((packages+=$(rpm -qa | wc -l)))"
;; ;;
esac esac
((packages == 0)) && unset packages ((packages == 0)) && unset packages
@ -678,21 +676,16 @@ get_de() {
"FreeMiNT") "FreeMiNT")
get_wm get_wm
if [ -e /proc/thing* ]; then for possibles in "$(ls /proc)"; do
de="Thing" case "$possibles" in
elif [ -e /proc/jinnee* ]; then *thing*) de="Thing" ;;
de="Jinnee" *jinnee*) de="Jinnee" ;;
elif [ -e /proc/tera* ]; then *tera*) de="Teradesk" ;;
de="Teradesk" *neod*) de="NeoDesk" ;;
elif [ -e /proc/mdesk ]; then *zdesk*) de="zDesk" ;;
de="mDesk" *mdesk*) de="mDesk" ;;
elif [ -e /proc/neod* ]; then esac
de="NeoDesk" done
elif [ -e /proc/zdesk* ]; then
de="zDesk"
else
de="Atari"
fi
;; ;;
*) *)
@ -807,19 +800,16 @@ get_wm() {
;; ;;
"FreeMiNT") "FreeMiNT")
if [ -e /proc/xaaes* ]; then wm="Atari AES"
wm="XaAES" for possibles in "$(ls /proc | awk -F'[ .]' '/aes|geneva/ {print $1}')"; do
elif [ -e /proc/myaes* ]; then case "$possibles" in
wm="MyAES" *xaaes*) wm="XaAES" ;;
elif [ -e /proc/naes* ]; then *myaes*) wm="MyAES" ;;
wm="N.AES" *naes*) wm="N.AES" ;;
elif [ -e /proc/geneva* ]; then geneva) wm="Geneva" ;;
wm="Geneva" esac
else done
wm="Atari AES"
fi
;; ;;
esac esac
fi fi
@ -1163,10 +1153,9 @@ get_cpu() {
;; ;;
"FreeMiNT") "FreeMiNT")
cpu="$(cat /kern/cpuinfo | awk -F':' '/CPU:/ {printf $2}')" cpu="$(awk -F':' '/CPU:/ {printf $2}' /kern/cpuinfo)"
speed="$(cat /kern/cpuinfo | awk -F':' '/Clocking:/ {printf $2}' | awk -F'.' '{ printf $1 }')" speed="$(awk -F'[:.]' '/Clocking:/ {printf $2}' /kern/cpuinfo)"
;; ;;
esac esac
# Remove un-needed patterns from cpu output. # Remove un-needed patterns from cpu output.
@ -1511,11 +1500,11 @@ get_memory() {
;; ;;
"FreeMiNT") "FreeMiNT")
mem_total="$(cat /kern/meminfo | awk -F ':|kB' '/MemTotal:/ {printf $2}')" mem_total="$(awk -F ':|kB' '/MemTotal:/ {printf $2}' /kern/meminfo)"
mem_free="$(cat /kern/meminfo | awk -F ':|kB' '/MemFree:/ {printf $2}')" mem_free="$(awk -F ':|kB' '/MemFree:/ {printf $2}' /kern/meminfo)"
mem_used="$(( mem_total - mem_free ))" mem_used="$((mem_total - mem_free))"
mem_total="$(( mem_total / 1024 ))" mem_total="$((mem_total / 1024))"
mem_used="$(( mem_used / 1024 ))" mem_used="$((mem_used / 1024))"
;; ;;
esac esac
@ -1907,9 +1896,8 @@ get_term() {
esac esac
# Most likely TosWin2 on FreeMiNT - quick check # Most likely TosWin2 on FreeMiNT - quick check
if [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]]; then [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && \
term="TosWin2" term="TosWin2"
fi
# Check $PPID for terminal emulator. # Check $PPID for terminal emulator.
while [[ -z "$term" ]]; do while [[ -z "$term" ]]; do
@ -2464,9 +2452,8 @@ get_cols() {
# TosWin2 on FreeMiNT is terrible at this, # TosWin2 on FreeMiNT is terrible at this,
# so we'll reset colors arbitrarily # so we'll reset colors arbitrarily
if [ "${term}" == "TosWin2" ]; then [[ "$term" == "TosWin2" ]] && \
printf "%b\n" "\\e[30;47m" printf "%b\n" "\\e[30;47m"
fi
# Tell info() that we printed manually. # Tell info() that we printed manually.
prin=1 prin=1