misc: cleanup

This commit is contained in:
Dylan Araps 2018-06-04 07:36:56 +10:00
parent 23d02ae90e
commit 05b0d1055b

View file

@ -773,24 +773,24 @@ get_os() {
# $kernel_name is set in a function called cache_uname and is # $kernel_name is set in a function called cache_uname and is
# just the output of "uname -s". # just the output of "uname -s".
case "$kernel_name" in case "$kernel_name" in
"Darwin") os="$(sw_vers -productName)" ;; "Darwin") : "$(sw_vers -productName)" ;;
"SunOS") os="Solaris" ;; "SunOS") : "Solaris" ;;
"Haiku") os="Haiku" ;; "Haiku") : "Haiku" ;;
"MINIX") os="MINIX" ;; "MINIX") : "MINIX" ;;
"AIX") os="AIX" ;; "AIX") : "AIX" ;;
"IRIX"*) os="IRIX" ;; "IRIX"*) : "IRIX" ;;
"FreeMiNT") os="FreeMiNT" ;; "FreeMiNT") : "FreeMiNT" ;;
"Linux" | "GNU"*) "Linux" | "GNU"*)
os="Linux" : "Linux"
;; ;;
*"BSD" | "DragonFly" | "Bitrig") *"BSD" | "DragonFly" | "Bitrig")
os="BSD" : "BSD"
;; ;;
"CYGWIN"* | "MSYS"* | "MINGW"*) "CYGWIN"* | "MSYS"* | "MINGW"*)
os="Windows" : "Windows"
;; ;;
*) *)
@ -799,6 +799,7 @@ get_os() {
exit 1 exit 1
;; ;;
esac esac
os="$_"
} }
get_distro() { get_distro() {
@ -1000,8 +1001,9 @@ get_distro() {
# Get OS architecture. # Get OS architecture.
case "$os" in case "$os" in
"Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") machine_arch="$(uname -p)" ;; "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT")
*) machine_arch="$kernel_machine" ;; machine_arch="$(uname -p)" ;;
*) machine_arch="$kernel_machine" ;;
esac esac
[[ "$os_arch" == "on" ]] && \ [[ "$os_arch" == "on" ]] && \
@ -1288,8 +1290,8 @@ get_packages() {
esac esac
# List these last as they accompany regular package managers. # List these last as they accompany regular package managers.
has "flatpak" && tot flatpak list has "flatpak" && tot flatpak list
has "snap" && tot snap list && ((packages-=1)) has "snap" && tot snap list && ((packages-=1))
;; ;;
"Mac OS X" | "MINIX") "Mac OS X" | "MINIX")
@ -1319,8 +1321,7 @@ get_packages() {
;; ;;
"IRIX") "IRIX")
tot versions -b tot versions -b && ((packages-=3))
((packages-=3))
;; ;;
esac esac
@ -3980,15 +3981,15 @@ set_text_colors() {
case "$bar_color_total $1" in case "$bar_color_total $1" in
"distro "[736]) bar_color_total="$(color "$1")" ;; "distro "[736]) bar_color_total="$(color "$1")" ;;
"distro "[0-9]) bar_color_total="$(color "$2")" ;; "distro "[0-9]) bar_color_total="$(color "$2")" ;;
*) bar_color_total="$(color "$bar_color_total")" ;; *) bar_color_total="$(color "$bar_color_total")" ;;
esac esac
} }
color() { color() {
case "$1" in case "$1" in
[0-6]) printf '%b\e[3%sm' "$reset" "$1" ;; [0-6]) printf '%b\e[3%sm' "$reset" "$1" ;;
7 | "fg") printf '\e[37m%b' "$reset" ;; 7 | "fg") printf '\e[37m%b' "$reset" ;;
*) printf '\e[38;5;%bm' "$1" ;; *) printf '\e[38;5;%bm' "$1" ;;
esac esac
} }
@ -4100,7 +4101,7 @@ cache() {
get_cache_dir() { get_cache_dir() {
case "$os" in case "$os" in
"Mac OS X") cache_dir="/Library/Caches" ;; "Mac OS X") cache_dir="/Library/Caches" ;;
*) cache_dir="/tmp" ;; *) cache_dir="/tmp" ;;
esac esac
} }